aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes jms pub sub Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "jms pub sub" Watch "jms pub sub" New topic
Author

jms pub sub

Pinda Ros
Ranch Hand

Joined: Apr 14, 2003
Posts: 65
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


NanoAgent is an Artificial intelligence RoBot of microscopic proportions built by means of nanotechnology
eammon bannon
Ranch Hand

Joined: Mar 16, 2004
Posts: 140
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

Joined: Apr 14, 2003
Posts: 65
Hello and thank you for your answer,
Do you know if it is necessary to have a message listener?
pinda
eammon bannon
Ranch Hand

Joined: Mar 16, 2004
Posts: 140
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

Joined: Apr 14, 2003
Posts: 65
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

Joined: Apr 14, 2003
Posts: 65
Problem solved, i attach the files for future reference to others...
mdb for non-durable messages
subscriber

publisher
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: jms pub sub