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 SubscribersBy default there won’t be any subscribers available for our just created topic.
Create a new Durable Subscriber (MyTopicSubscriber)
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
Click show messages to view the content
Durable topics are topics which persistence every incoming message for a durable consumer. Each durable consumer will receive his own copy of the mesage.
Situation 1:
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 receivedSituation 2:
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.
8 Responses to “Weblogic, topics and (non)-durable subscribers”
it might not be rocket science but it’s helpful
thanks for sharing
[…] the Durable Durable Subscribers tab, we still see only 1 subscriber, the one we created in this blog. QBrowser created a non-durable subscriber for us on the […]
Hi Eric,
Thanks for nice article.I am also follow this but when I test I got an error like
The invocation resulted in an error: [JMSClientExceptions:055091]Destination DemoJMSTopicModule!MyTopic must be a queue.
Any Suggestions
Thanks
suji
If you send this from the OSB i guess you misconfigured the business service to write to the queue endpoint instead of a topic endpoint.
Hi Eric,
Thanks for quick reply.
My business-service config is like
Ant XML service
TransportType:jms
EndPointURI:jms://localhost:7001/weblogic.jms.XAConnectionFactory/MyTopic
Before this I follow the blog to create Topic and durable subscribe.
Once again Thanks
Suji
On one of the tabs of the business service you can configure the type (topic or queue). Is that one correctly set?
Thanks a lot,I got it.
Hi Eric,
Good Post.I have a requirement like publish the message (xml document) to the Topic.I have three subscribers,based on xml attribute value how can I subscribe the message.Any suggestions and directions.
Thanks
Mani