• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MDB

 
raj joe
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is difference b/w stateless session bean and MDB.
 
Masoud Kalali
Author
Ranch Hand
Posts: 531
Java Mac OS X Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
MDB or Message Driven Bean are in use when you have to communicate with some JMS servers to achive an Asynchronous communication , or when you want to use some queue to listen on them or when you want to subscribe into some topics in a JMS server.
we use MDB is two way
1- publish/subscribe pattern
usually we use them when we have to announce some events to more than one intrested entity , for example you want to tell 2 or more (dynamicly changes) application that stock price is changed , so they all can update thier status.
in this scenario one who announce the change is a publisher and those application who are intrested in stock change are subscriber. i should tell that subscribers and publishers could be dynamically change.
2-Point-to-Point Messaging
you can use this scenario when you want to delive a message to one and only one listener. in this type you have a queue and some clients on the queue.
in this scenario whichever listener who recive and take the message from queue will own the message and no one else will be allowd to use it.

JMS has some features like :
1-delivery guarantee.
2-persistent message
3-usually failover , Clustring capability
....

A session bean is a logical executer of an application.
you can do your business process in a session bean , for example you can check user authentication in a session bean, you can execute create , find , insert .... over your Entity beans from inside a session bean ...

an stateless session bean could be used for operations that are the same for all users . for example to execute a query , to insert a record ...
when you need to keep track of a user actions and execute an action based on user profiles then you should use an statefull session bean.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic