• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to read a JMS message instead of consume ?

 
sam joe
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose I have a durable subscriber off line and I have a couple of messages publish to it. Now If I want to write another client to only read those messages instead of consume them (so the original durable subscriber still have a chance to get those messages). How should I do this?

Thanks,
Sam.
 
Andreas Schaefer
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could use transactions within the Session and rollback the transaction after you read all the provided messages but be aware that this is a HACK!!!
Because you have to use the durable subscription there is also the chance that during this period orginal subscriber may fail to create a durable subscription again, so be warned.

Another way is to use a queue and use the Queue Browser rather than a durable subscription. Just make sure that the message are persistent to avoid loosing messages during a server crash/restart.

-Andy
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by sam joe:
Suppose I have a durable subscriber off line and I have a couple of messages publish to it. Now If I want to write another client to only read those messages instead of consume them (so the original durable subscriber still have a chance to get those messages). How should I do this?

Thanks,
Sam.


Why not consume the message . The other durable subsribers will still recieve the message, right ? It is not a queue where the message can be consumed by just one client.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!