For one of my testcases i implemented a simple process in the Oracle Service Bus which stores messages on a Weblogic topic.
This blog will not contain any rocket science, just a quick overview on how to deal with topics and subscribers in Weblogic.
In case of storing messages on Weblogic queues you can just browse in the Weblogic Console and look into the messages
To be able to look at the message available in a topic we need to first subscribe to the topic.
- Create a new JMS Server
- Create a new JMS Module
- Create a new Topic (MyTopic) in the new JMS Module
- Create a new Durable Subscriber on the topic
Go to the Topic > Monitoring > Durable Subscribers
No messages available in the topic.
- Send messages to the topic
For this i created a simple OSB service which stores the messages in the topic (jms transport, endpoint jms://localhost:7001/weblogic.jms.XAConnectionFactory/MyTopic)
Trigger the process and use some test payload data
- Check the Durable Subscriber overview again
Durable topics are topics which persistence every incoming message for a durable consumer. Each durable consumer will receive his own copy of the mesage.
We add a non-durable consumer on the topic.
We send 10 messages to the topic, at message 5, we stop the non-durable subscriber and we continue sending the message till the last mesage.
We start the non-durable subscriber again. Now it will not receive message 5 till 10 because it isn’t durable. So the messages won’t be received
We add a durable subscriber on the topic.
We send 10 messages to the topic, at message 5, we stop the durable subscriber and we continue sending the message till the last mesage.
We start the non-durable consumer again. Now it will receive message all the persisted messages and the new incoming messages again.
See this clear explanation on the Active MQ site about Durable queues and topic.
So the JMS Provider itself knows when using a durable topic subscription what its subscriber are identified by combination of ClientID and the durable subscriber name.
It knows what messages got delivered and which aren’t. When the subscriber goes down the JMS providers knows which messages to keep available for the subscriber for delivery. The subscriber connects again and receives those messages.
In case of a non-durable subscriber those messages would have been lost.