Java Integration
Transform Anything with Java
Consuming Message from a topic with Durable and Non-Durable Subscription
The major difference between a durable and a non-durable subscriber is that a durable subscriber will have the previlage of failing and still the message will be available for the subscriber to pick up one he is back after recovery.
A Non-durable subscriber will lose message in case of a failuer. A non durable subscription works much faster than the other one. This becomes useful if the messages can be recovered in some other mean.
In the example we will create a Durable Subscriber and describe the step for doing a non-durable subscription too.
1. Login to OSB, create a Session.
2. Create a Project Named ConsumeTopic. Also create a folder named Proxy Service.
3. Create a Proxy Service.
4. In General Configuration choose Service Type as Messagin Service and Name the service as durableSubscriber
5. In the Message Type Configuration, choose Text as Request Message Type.
6. In the Transport Configuration, choose jms as protocol and URI as jms://localhost:7001/weblogic.jms.XAConnectionFactory/jms.SourceTopic.
7. On the JMS Transport Configuration, expand Advanced Settings and Check the check box Durable Subscription.

8. Goto the last step and Save the Proxy Service.
9. Now open the message flow of the Proxy Service.
10. Add a Request Response Pipeline, Add ad Stage to the request Pipeline. Edit the Stage.
11. Add a Log to the stage and assign $body to the Expression and some Text in the Annotation.
12. Now to test this. We will enable it, place a message. Then disable the proxy service and place the message again.
13. Since this is a durable subscriber, when we enable the proxy service again the message should be available.
14. Weblogic does not support placing message in a topic. So I had to configure a Business service to place the message.
Here are the output.
a). Placed a Message in the Topic, keeping the Proxy Service Enabled.


b) Now let us disable the proxy Service to consume the Topic Message and Publish a message.
c) The message will persist in the queue. Once the Proxy Service is enabled, the message will be picked up again.


d) Let us update the subscribing Proxy service to be non durable and see how it works. That will be something for you to Experiment. :)