File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jms pub sub

 
Pinda Ros
Ranch Hand
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I have developed and JMS EJB with a publisher and subscriber.
My question is when i send a message to the message driven bean which is deployed in jboss app/server through the publisher, is it important which client starts first, that is subscriber or producer?
Any references to jms and mdbs will be highly appreciated.
Thank you in advance.
pinda
 
eammon bannon
Ranch Hand
Posts: 140
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't matter what "starts first" - since you are not sending a message directly from one MDB to another, you send a message to a topic. A message consumer subscribes to a topic, and listens for messages to arrive on it. Its a completely asynchronous process, so nothing is required of the consuming MDB by the producing MDB. Depending on your persistance strategy you could ever stop the server and the message will still reach your consumer.
 
Pinda Ros
Ranch Hand
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello and thank you for your answer,
Do you know if it is necessary to have a message listener?
pinda
 
eammon bannon
Ranch Hand
Posts: 140
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, nothing inthe publisher requires this. But it would be silly not to - otherwise your just gradually filling a topic up with useless messages.
 
Pinda Ros
Ranch Hand
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what exactly is the usage of the message listener?
Is the subscriber using the message listener, when a message is published, to receive the message and remove it from the topic.
Will the subscriber be able to receive another message from a publisher on the same topic.
At the moment i have developed an mdb,publisher and subscriber and i receive only the first message without any listener whatsoever.
However if i add the following line: subscriber.setMessageListener(this); i get the following exception: javax.jms.JMSException: A message listener is already registered. My class implements MessageListener and onMessage method.
Any ideas?
Thank you in advance.
pinda
 
Pinda Ros
Ranch Hand
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem solved, i attach the files for future reference to others...
mdb for non-durable messages
subscriber

publisher
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic