Thursday, July 19, 2018

JMS Topic and Subscribers in OSB Proxy service

JMS Queue vs JMS Topic

JMS Queue is Point-to-point solution based on Publisher/ Subscriber model, which means there can be only one Subscriber per queue. If the Subscriber is down, the messages will persist in the queue until the Subscriber comes up. Once the Subscriber is up, the message will be consumed and processed.

JMS Topic is a distribution mechanism for publishing messages that are delivered to multiple subscribers, which means there can be multiple subscribers per Topic. Single message can be consumed by multiple subscribers and processed individually. 


  • With Durable Subscription Enabled in Proxy :- If one of the subscriber is down, the message will be persisted in Topic till that subscriber is available.However the same message will be consumed by other consumers.

  • With Durable Subscription Disabled in Proxy :- If one of the subscriber is down, the message will not be persisted in Topic. However the message will be consumed by other consumers(whatever is up and running).
So based on your scenario you can decide whether to create a durable subscriber or not. We will see both the options here.

First lets create a JMS Topic.
Login to Weblogic console. Navigate to JMS Module and select the module you want to create the topic.









You can select one of your JMSServers as the Target.

We have the JMS Topic ready, now we can start creating the Subscribers in OSB Proxy Service.

Login to SbConsole and Create a new Project.
And Create a new Proxy Service with service type as "Any XML Service"



Select JMS as Protocol and enter host,port and Jndi name of topic.
Sample: jms://22.22.22.22:7001/weblogic.jms.XAConnectionFactory/test.topic


Select option as "Topic"


This is the place where you have to  decide whether you need Durable Subscriber or not.!!! First lets create Proxy service with Durable Subscription disabled.



Now click Last and save the configuration.

Lets add a alert in the proxy pipeline .So that we can validate the execution of Proxy service.

** assuming you already a alert destination.
 

Now create a another proxy service to listen to the same topic. (you can just clone the first proxy service) and edit the alert summary as "Testing Topic -Proxy Service 2".

Now we have created 2 proxy service listening to the same JMS topic.

So once you produce the message, both proxy service should consume the message and create the alert messages.

To produce the message into topic, i'm creating a new business service with same JNDI details. (testing purpose).
Finally  your project will look something like below.


Activate the Session.

And your Topic will look like below.


Since you have created a proxy without durable subscription. you will not see any rows in Durable subscribers tab.


Execute the Business Service with some sample XML.
You will immediately see 2 alerts generating in the operations tab.


Hence you can confirm your message have been picked up by both proxy service and your subscribers are working fine.

******************************************************************

Now lets enable the durable subscription in proxy service(both proxy service).

Once you have enabled the durable subscription and activated the session. You  can see the changes in weblogic console as well. Now Durable subscribers tab will have 2 new rows and its status.



You can test the scenarios, like 
Keep both proxy services up and running, see what happens.
Disable one of the proxy service and see whether the messages are stored in Topic.
Disable both proxy service and see what happens.

How to disable a Proxy Service ? Click here

2 comments:

  1. It 's an amazing and awsome blog Thanks for sharing
    Oracle SOA Online Training

    ReplyDelete
  2. Las Vegas (NV) Casino - Mapyro
    Casino MapYRO Realtime 보령 출장마사지 Gaming Realtime Gaming Realtime 아산 출장안마 Gaming 태백 출장안마 Realtime Gaming Realtime Gaming Realtime 밀양 출장안마 Gaming Realtime Gaming Realtime Gaming Real 전라남도 출장안마

    ReplyDelete