This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 21 Developer (Exam 1Z0-830) Java SE 17 Developer (Exam 1Z0-829) Programmer’s Guide and have Khalid Mughal and Vasily Strelnikov on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

jms pub sub

 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Problem solved, i attach the files for future reference to others...
mdb for non-durable messages
subscriber

publisher
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic