Reputation: 1058
I am currently reading about JMS
and after a few articles, there is a little bit of confusion about durable subscription with non-persistent messages in my head. Let's start with:
http://www2.sys-con.com/itsg/virtualcd/java/archives/0604/chappell/index.html - It says:
If a nonpersistent message is intended for a disconnected durable subscriber, the message server saves the message to disk as though it were a persistent message. In this case the difference between persistent and nonpersistent messages is subtle, but very important. For nonpersistent messages the JMS provider could fail before it's had a chance to write the message out to disk on behalf of the disconnected durable subscribers. Messages may be lost
And another source: http://openmessaging.blogspot.com/2009/04/durable-messages-and-persistent.html says something totally different:
If there are any durable subscriptions on this topic, then a copy of the message is sent to those durable subscribers that are active. For those durable subscriptions that are inactive, a copy of the message is saved in memory and sent to them when they next become active.
This saved message will be lost if the broker is restarted. Since non-persistent messages are not saved on disk, a broker restart means that any inactive durable subscriptions that have not yet received the message will miss out on the message.
So, what is the truth :)?
Upvotes: 3
Views: 2480
Reputation: 9623
With the Persistent messages, broker will save messages to disk, but depends on what kind of subscribers it has, if no durable subscribers then with some implementations, messages are deleted once delivered.
Upvotes: 7
Reputation: 15273
Generally speaking:
1) Non-persistent messages are not saved to disk. Hence they don't servive messaging provider restart.
2) On the other hand persistent messages are saved to disk. Hence they servive messaging provider restart.
Most messaging providers follow above concept. But as you pointed out there are some implementation specific deviations. For example IBM MQ has a concept of "Semi Persistent" message (NPMCLASS
attribute). Although these are "Non Persistent" messages, they servive normal shutdown and restart of MQ messaging provider. If MQ ends abnormally, then "Semi Persistent" messages are lost.
So it boils down to implementation specifics.
Hope this helped.
Upvotes: 3