TIBCO EMS Durable Subscription for Topic Messages Persistence

By | February 11, 2016

When using EMS topic based communication; by default, if a message is published to a topic and one or more subscribers to that topic are currently offline (not active); they won’t receive the message as message won’t persist in the EMS Server. However, If persistence of messages published to a topic is required; TIBCO EMS provides option for this by setting the subscriber as “durable”.

In this post; I will explain in detail about durable subscribers as well as an example scenario in which messages are persisted for a durable subscriber currently offline.

What is TIBCO EMS Durable Subscriber?

Durable subscribers to a EMS topic are those subscribers which are entitled to receive a message published to a topic once they are alive and ready to consume; even if they were not active when the message was published by the publisher to that topic.

If a message is sent to a topic which has at least one durable subscriber; message will be stored/ persisted by the EMS Server till the time durable subscribers have retrieved the message or the expiration time for the message has reached.

Example of using durable Subscribers in a TIBCO BW Project

To further shed the light on usage of durable subscribers; let’s consider an example in which a publishing TIBCO BW process sends a simple message to a topic “topic.durable.test”. This topic has two subscribers in the form of two processes—ProcessA and ProcessB both acting as durable subscribers so that a message published to the topic is persisted in EMS Server till the time both of these processes have subscribed/consumed the message.

The process which is sending the messages to this topic is as shown below with a JMS Topic publisher activity and nothing much fancy:

tibco jms send message to a topic for durable subscriber

 

Make sure that you have already crated the topic in your EMS Server using the below command in EMS administration tool:

create topic topic.durable.test

Now in order to show the usage of durable subscription; I have created two subscriber processes–ProcessA and ProcessB as shown below:

Make sure that you check the Durable Subscription checkbox and specify a Subscription Name:

 

durable subscriber no 1

The other process (ProcessB) is similar to ProcessA and that process is also subscribing to the same topic in durable mode:

 

durable subscriber no 2

Now if you load these processes in designer tester and then enter the command “show durables” in the EMS administration tool; you can see the subscriptions as shown below:

show durables command tibco ems

 

Now, let’s run the process “SendMessage” and load only one subcriber process “ProcessA” while keeping ProcessB in offline/inactive state.

As you can see below; after the message is sent to the topic by SendMessage process; ProcessA successfully retrieves the message by using JMS Topic subscriber activity.

tibco durable subscriber consume message

 

However, we know that we have another durable subscriber for the same topic which does have a subscription but is currently inactive (ProcessB). If you check in the EMS administration tool by using the command “show topic topic.durable.test”, you will observe that due to durable nature of the subscriber; there is a pending message still residing in the topic, waiting for the other subscriber to get alive and consume it:

tibco durable subscriber show topic command

Note that if the subscriber wasn’t durable; the message would have been discarded and only the active subscriber would have consumed it.

Ajmal Abbasi

Ajmal Hussain Abbasi is a TIBCO Consultant By Profession with more than 6 years experience in TIBCO products. He has extensive practical knowledge of TIBCO Business Works, TIBCO Spotfire, TIBCO BE, EMS and TIBCO ActiveSpaces. He has worked on a number of highly critical integration projects in Telecom sector by using his skills in Tibco Designer, Adapters, TIBCO EMS, RV, Administrator, TIBCO BE, TIBCO ActiveSpaces etc. Ajmal Abbasi is also experienced in developing solutions using Oracle PL/Sql, Linux and Java. You can contact Ajmal Abbasi for Consultancy, Technical Assistance and Technical Discussions.

More Posts - Website - Facebook - LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *