Powered By Blogger

Friday, May 31, 2013

Duplicate JMS message consumption in cluster


We come across common situation where we have duplicate JMS message consumption from BPEL where there is a cluster


For example, if we have a cluster of 3 nodes then when we deploy BPEL to consume message then there will be three BPEL instances processing same JMS message.This is because the nature of how distributed topics combined with clustered environment works

Obviously nobody wants to process same message multiple times.
To make sure only one node processes the message we need to set below property in JMS .JCA file

<property name="DurableSubscriber" value="UniqueSubscriberName"/>

This property name is used to identify a durable subscription. When working with durable subscriptions ensure that ClientID is also specified in addition to DurableSubscriber property. ClientID is specified as part of the factoryProperties property when defining a JMS adapter managed connection factory instance
Weblogic jms expects the combination of durable subscription + clientID to be unique across the durable subscriptions, just client ID or durable subscriber property alone does not suffice.

To set ClientID on deployment JNDI, follow below steps

1.Log in in to the WLS console.
2.Navigate to => Deployments and select "JmsAdapter" from the right hand side.
3.On the configuration tab expand oracle.tip.adapter.jms.IJmsConnectionFactory and select your connection factory (e.g. "eis/wls/Topic")
4.In the "FactoryProperties" add the Id (e.g. "ClientID=SOAClientSubscription1;")
5.Click on save and follow the onscreen instructions and remember to update the JmsAdapter, in order for the changes to take effect

4 comments:

  1. With JMS 2.0, shared durable consumer can be created to avoid duplicate message.
    https://jms-spec.java.net/2.0/apidocs/javax/jms/JMSContext.html#createSharedDurableConsumer(javax.jms.Topic,%20java.lang.String)

    ReplyDelete