This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have configured Topic (Publish - Subscriber Model) in JMS. I have written Message Driven Bean, Configured Deployment Descriptors, Deployed the application onto Application Server ( JMS Server). I have writen client, which sends the messages onto JMS Server. The Message Driven Bean's onMessage() automatically prints the received message from the topic by the client.
The question is how do we write multiple subscribers (Message Receivers) that receives each message sent by client. Do we write multiple Message Driven Beans?
We are writing application, which models Publish-subscriber ( Topic). The client keeps on writing messages onto JMS Topic. On the Server(Receiver) side, we have several application programs that subscribes itself to single topic and read the messages.
Do we write stand alone progams that just implements message listeners or multiple Message Driven Beans? Any ideas will be appreciated.
Let's say you have a Customer topic. You can have many message-driven bean types which subscribe to that topic, eg SalesBean and MarketingBean. Upon receipt of a message, the container will pull one instance of SalesBean and one instance of MarketingBean from their pools to service that message.
You could certainly write multiple message listeners, but I prefer MDBs if possible. They are, of course, listeners as they must implement the javax.jms.MessageListener interface.
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Joined: Jun 17, 2005
Thanks Roger for the reply.
I have written multiple POJO's, which implements MessageListerners. These are working fine. I am trying to implement Message Driven Beans version for our application.
we are developing an application that writes transaction messages onto the Topic. There are several client graphical User Interfaces , which connects to the Topic, subscribes itself and keeps on displaying the transactions on user interface as and when the transaction happens.
This is my Question: I have written one Message Driven Bean, configured Deployment Descriptor, Deployed and it works fine for one MDB(It prints transaction in onMessage()).
Let us say, we have a pool of 20 MDB's. As soon as Message is published, Container takes one MDB from pool and assigns to perform the task.
I am thinking of having each MDB that subscribes itself and start displaying transactions, when Graphical User Interface is opened by user. How do you get instance of MDB from the pool, when the user interfaces starts up?
Let us say, 10 users have opened 10 screens. DO we have 10 instances of same MDB that display all transactions in 10 screens? Does MDB's fit in this kind of scenario?
Appreciate your ideas.
Joined: Sep 29, 2002
The container will process each message as it arrives. So, if 10 messages arrive, then they will all be processed. As the container is multithreaded, then there should be no delay in processing the messages as each will typically be processed in a separate thread by an MDB instance.
Joined: Jun 17, 2005
Thanks for the reply Roger again.
I am clear that each message will be processed in a separate thread by MDB instance. But In our case, each message(Publish-subscriber model) is being simultaneously displayed by 10 clients(screens) at same time. How does 10 clients subscribe simultaneously and get the same message at same time using Message Driven Bean?
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com