We had created a message driven bean (MDB) which uses JMS technology to send messages, the messages to be sent   were from  an applicant like JMS client  which makes use of the defined jms queue or topic.
We had  set up the distributed topic across a two managed server cluster, each of the managed server  has a JMS server, each of the JMS server  was targeted  subdeployment and the distributed topic was targeted to this subdeployment.
JMS Server Diagram


 
Each of the server can publish to the topic using the distributed jndi name. The MDB is  also deployed across the cluster  which connects  to the distributed JNDI name. While creating the JMS topic we had created the topic as  UDD topic( uniform distributed topic ). The forwarding policy of the topic was set to Replicated mode which is also the default mode.


 

Since in the case of the Replicated mode, all physical topic members will receive each sent message . If a message  arrives at one of the physical topic members,  a copy of this message is forwarded to the other members of that uniform distributed topic. 
We had changed the forwarding policy to partitioned  so that the physical member receiving the message is the only member  of the uniform distributed topic that is aware of the  message. When a message is published to the logical name of a Partitioned uniform distributed topic, it will only arrive on one particular physical topic member. Once a message arrives on a physical topic member, the message is not forwarded to the rest of the members of the uniform distributed destination, and subscribers on other physical topic members do not get a copy of that message. But with this also the the  message was  being sent twice and duplication of the messages arrived. This was working  in a  One-Copy-Per-Server – mode which  specifies that each deployment instance of the MDB application receives every message published to a distributed topic. Some thing like below:
 

In order to avoid  this particular scenario it was needed to have a solution where a  message  should be sent to the distributed topic only once, so we  had to use the One-Copy-Per-Application  distribution mode where  it specifies that each deployment instance of the MDB application receives every message published to a distributed topic.

In order to achieve this  we had to add a property called as topicMessagesDistributionMode in combination with the distributedDestinationConnection setting or the generate-unique-client-id  to control the topic message processing behaviour. This can be set either in the Activation config property method of the annotation method  or can be set in the ejb jar .xml of the MDB as an < activation-config-property>

The valid values for this property are: 
   One-copy per application.
                  One copy per server.
3              Compatability.

Below example shows a snippet of MDB that uses a durable subscription to a JMS topic, transactionally processes the messages, and forwards the messages to a target destination.



package test;

importjavax.annotation.Resources;

importjavax.annotation.Resource;

importjavax.ejb.ActivationConfigProperty;

importjavax.ejb.MessageDriven;

importjavax.ejb.MessageDrivenContext;

importjavax.ejb.TransactionAttribute;

importjavax.ejb.TransactionAttributeType;

importjavax.jms.*;



@MessageDriven(mappedName = "FaultPollTopic", activationConfig = {

@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),

@ActivationConfigProperty(propertyName = "subscriptionName", propertyValue = "ErrorReportingService"),

@ActivationConfigProperty(propertyName = "topicMessagesDistributionMode", propertyValue = "One-Copy-Per-Application"),

@ActivationConfigProperty(propertyName = "distributedDestinationConnection", propertyValue = "LocalOnly")   }

)