Examples of how to define the sharedSubscription property
We can define the sharedSubscription property of an activation specification within a WebSphere Application Server Liberty server.xml file. Alternatively, we can define the property within a message driven bean (MDB) using annotations.
Example: defining within a Liberty server.xml file
Within a WebSphere Application Server Liberty server.xml file, you define an activation specification as shown in the following example. This example creates a durable shared subscription to a queue manager on localhost/port 1490.<jmsActivationSpec id="SubApp/SubscribingEJB/SubscribingMDB" authDataRef="JMSConnectionAlias"> <properties.wmqJms hostName="localhost" port="1490" maxPoolDepth="5" subscriptionName="MySubName" subscriptionDurability="DURABLE" sharedSubscription="true"/> </jmsActivationSpec>
Example: defining within an MDB
We can also define the sharedSubscription property within the MDB using annotations as shown in the following example:@ActioncationConfigProperty(propertyName ="sharedSubscription", propertyValue = "true")The following example shows a piece of MDB code that uses the annotations method:/** * Message-Driven Bean example using Annotations for configuration */ @MessageDriven( activationConfig = { @ActivationConfigProperty( propertyName = "destinationType", propertyValue = "javax.jms.Topic"), @ActivationConfigProperty( propertyName = "sharedSubscription", propertyValue = "TRUE"), @ActivationConfigProperty( propertyName = "destination", propertyValue = "JNDI_TOPIC_NAME") }, mappedName = "Stock/IBM") public class SubscribingMDB implements MessageListener { // Default constructor. public SubscribingMDB() { } // @see MessageListener#onMessage(Message) public void onMessage(Message message) { // implement business logic here } }