WebSphere MQ allows you to specify publish and subscribe to multiple queues, which means that each subscriber retrieves all of its messages from a specific queue that is assigned to that subscriber. JMS creates a new dynamic queue for each subscriber, and each subscriber has exclusive use of the dynamic queue assigned to it.
When you use the multiple queue approach, you do not define an explicit queue name. Instead, you define a prefix name on which all dynamic queue names are based. The prefix name needs to end in an asterisk (*); for example, “SYSTEM.JMS.D.PAYROLL.*”. All dynamic queues that are associated with this subscription will have names that start with “SYSTEM.JMS.D.PAYROLL”.
For more detailed information about WebSphere queues and configuring multiple queues, see Subscriber Options.
There are two ways to define publishing and subscribing to multiple queues for the JMS BC:
Enter the destination name in the WSDL. The destination name provides only the prefix as described above, and does not include the full queue name. In this case, the JMSJCA parses the destination name to determine the actual destination name and properties. For example:
<operation name="JMSInOperation"> <jms:operation destination="jmsjca://?name=FinanceDurSubQueue=SYSTEM.JMS.D.PAYROLL.*" destinationType="Topic" ... subscriptionName="durSub-11"> <jms:options/> </jms:operation> |
This is how the same destination name would appear in the WSDL Properties panel.
Create an Admin Object Resource on the GlassFish Admin Console and use a JNDI lookup in the WSDL. To create the Admin Object Resource, do the following:
Launch the GlassFish Admin Console and expand Resources > Connectors > Admin Object Resources.
Create a new resource, and add a Name property using the same naming convention as above.
The following figure illustrates an Admin Object Resource:
Enter the JNDI lookup in the WSDL destination property, as shown below:
<operation name="JMSInOperation"> <jms:operation destination="lookup://jms/WMQTopic" destinationType="Topic" subscriptionName="durSub-11" ....> <jms:options/> </jms:operation> |
After you configure the JMS BC to use multiple WebSphere queues, be sure to enable publish/subscribe on the WebSphere MQ broker. By default, it is not enabled in version 5.3 and 6.0.