Thursday, March 29, 2012

Subscribing from a Topic based on Message Type

Topic is used in order to publish a data and then multiple subscriber can subscribe to the same topic.

But there can be situation where in we have a single topic where in multiple business are publishing messages and the requirement is that based on some particular parmeter only one service should subscribe to the published topic.


This kind of situation can be handled by using the concept of advanced feature of jms in OSB which allows us to define Message selector as shown below.The message selector is used to match the data.

IT works in the following way.

Let suppose we are publishing a data in a topic with message type='App1'

This we can define in mediator as shown below.



Now this is publshing data in a topic and our requirement is that only one service whose message type is same as 'App1' should subscribe to this service,In that case we will go to the advanced configuration of OSB JMS configuration and define the same message type as message selector as shown below.



This configuration will allow only this particular servie to be called when a message will be published in the topic.

No comments: