Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Doubt in JMS pub/sub model

 
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Got a question about the pub/sub messaging model in JMS. Let's say there is a subscriber who has subscribed to a topic. The subscriber disconnects. Later he reconnects and resubscribes to the same topic. In which of the following scenarios will the subscriber get the messages that he missed when he was disconnected?

The missed messages are PERSISTENT and the subscriber has a DURABLE subscription - Yes
The missed messages are NON-PERSISTENT and the subscription is DURABLE - No
PERSISTENT messages and NON-DURABLE subscription - No
NON-PERSISTENT messages and NON-DURABLE subscription - No

So the subscriber will get the missed messages ONLY if the messages are PERSISTENT and his subscription is DURABLE. Is my understanding right? Are there any exceptions to be considered? Please clarify
 
Ranch Hand
Posts: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The missed messages are NON-PERSISTENT and the subscription is DURABLE - No



In durable subscription messages are persisted. So the above case does not arise.

So the subscriber will get the missed messages ONLY if the messages are PERSISTENT and his subscription is DURABLE. Is my understanding right? Are there any exceptions to be considered? Please clarify


Yes.
 
B.Sathish
Ranch Hand
Posts: 372
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for replying Pradip

In durable subscription messages are persisted. So the above case does not arise



If I am a topic publisher using the TopicPublisher.publish() method, I can specify the Delivery Mode argument to the publish() method as javax.jms.DeliveryMode.NON_PERSISTENT. Hence I am publishing a non-persistent message. But the topic subscriber can have a durable subscription to the topic. This is what I meant by the case of non-persistent messages and durable subscriptions. What will happen in this case?
 
Pradeep bhatt
Ranch Hand
Posts: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by B Sathish:
Thanks for replying Pradip



If I am a topic publisher using the TopicPublisher.publish() method, I can specify the Delivery Mode argument to the publish() method as javax.jms.DeliveryMode.NON_PERSISTENT. Hence I am publishing a non-persistent message. But the topic subscriber can have a durable subscription to the topic. This is what I meant by the case of non-persistent messages and durable subscriptions. What will happen in this case?



If there is a durable subscriber then a message has to be persisted even if you mention NON_PERSISTENT.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic