I was reading up on JMS of late. The more I read the more I got confused about the usage of terms persistent and durable in the context of JMS. Then I found this blog which cleared my issues. Thanks Nigel for the great post. :). Anyway here is the gist of that blog I committed to my memory.
- Persistent apply to messages while durable apply to subscriptions.
- Queues don’t have durable/ non-durable distinction because consumer always gets a durable subscription.
- For queues:
- Persistent : Message will be saved on disk and sent later if consumer is inactive.
- Non-persistent : Messages will be saved in-memory and sent later if consumer is inactive. But they will not survive a broker re-start.
- For topics:
- Persistent & Durable : Message will be saved both on-disk and in-memory and sent later if subscriber is inactive.
- Persistent & Non-Durable : Message will not be saved either in-memory or on disk and any inactive subscriber at the moment of message receipt at broker will not receive the message.
- Non-persistent & Durable : Message will be saved in-memory and sent later if subscriber is inactive. So it will not survive a broker re-start.
- Non-persistent & Non-Durable : Message will not be saved either in-memory or on disk and any inactive subscriber at the moment of message receipt at broker will not receive the message. Similar to Persistent & Non-Durable case.
- In all these cases message is sent immediately if subscriber is active.