Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JMS Application publish question

 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I have an application which uses JMS to publish/subscribe to messages.
I am having a hard time finding resources regarding explanations of using the publish method of the javax.jms.TopicPublisher class.
I have googled it and found countless examples, but cannot find anywhere that explains the meaning of the method arguments DeliveryMode and timeToLive.
Here is what I was able to find online :

public void publish( Topic topic, Message message, int deliveryMode, int priority, long timeToLive) throws JMSExceptionYou must provide a message. You may also specify the topic name, delivery mode (DeliveryMode.PERSISTENT or DeliveryMode.NON_PERSISTENT), priority (0-9), and time-to-live (in milliseconds). If not specified, the delivery mode, priority, and time-to-live attributes are set to one of the following:



What I can't seem to find is what the differance between persistant and notn persistant delivery modes are, and what time-to-live means. The reason I am asking, is that I am publishing a lot of messages and some are getting lost. I think I need to tweak something, maybe if the system is busy and I increase my time-to-live time, the message listener will have more time to recieve it?

Thanks for any info!
Kim
 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In a publish subscribe mechanism if the subscriber is not alive the messages gets thrown away. This is true even if you set to delivery mode PERSISTENT. The delivery mode persistent just means that in the event of a server crash the messages can be recovered and delivered to the subscribers connecting back.

I hope time to live parameter is to how long the server to keep a message if a subscriber is not alive before throwing it away


Thanks
raees
 
Kim Kantola
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much for your reply. I am wondering what would cause a message to not make it to the subscriber. I have log messages in my publisher and my subscriber. I can see that all messages are getting published, but only some are getting to the onMessage method of my subscriber. Not sure what to look for, any ideas? Thanks so much again for your reply.
 
Raees Uzhunnan
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know what JMS server you are using .. some time these serves have something called selectors. In a selector configuration if the selector on the topic does not match with the eslected property in the message .. the message gets thrown way ?.. do you have something like that
 
Kim Kantola
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using openJMS.
I do use a topic as follows :

When I publish I do this :


The serializable object that I am using "tagEvent" is declared as follows :



A coworker just pointed out to me that a problem may be that my Serializable TagEvent object does not implement a serialVersionUID value.
Does that ring a bell as a possible problem?
 
reply
    Bookmark Topic Watch Topic
  • New Topic