You can configure point-to-point messaging such as sending
of messages to a queue or receiving of messages from a queue.
Procedure
- Configure the messaging features in the server.xml file.
If you want to perform a JNDI lookup, then you must also add the jndi-1.0 feature.
<featureManager>
<feature>wasJmsServer-1.0</feature>
<feature>wasJmsClient-1.1</feature>
<feature>jndi-1.0</feature>
</featureManager>
- Configure the messaging engine to create a queue, called libertyQ,
as given in the following example.
<messagingEngine>
<queue id="libertyQ"
forceReliability="ReliablePersistent"
maxMessageDepth="5000">
</queue>
</messagingEngine>
- Declare a queue connection factory resource to create a
connection to the messaging engine as given in the following example.
<jmsQueueConnectionFactory jndiName="jms/libertyQCF" connectionManagerRef="ConMgr2">
<properties.wasJms
nonPersistentMapping="ExpressNonPersistent"
persistentMapping="ReliablePersistent"/>
</jmsQueueConnectionFactory>
<connectionManager id="ConMgr2" maxPoolSize="2"/>
- Declare a queue resource to create a Producer/Consumer
session to the queue, libertyQ, as given in the
following example.
<jmsQueue jndiName="jms/libertyQue">
<properties.wasJms queueName="libertyQ"
deliveryMode="Application"
timeToLive="500000"
priority="1"
readAhead="AsConnection" />
</jmsQueue>
- Declare an activation specification for the message-driven
beans that are deployed on the Liberty profile. The message-driven
beans use the activation specification to asynchronously consume messages
from the jmsQueue resource.
<jmsActivationSpec id="JMSSample/JMSApp/SampleMDB">
<properties.wasJms destinationRef="jms/libertyQue" />
</jmsActivationSpec>
The ID value must be given in
the following format:
application name/module name/bean name
format, where
application name is the
name of the application that is deployed,
module name is
the name of the module in which the bean is packaged, and
bean
name is the
ejb-name of the enterprise
bean. Ensure that the
destinationRef attribute is
pointing to a valid
jmsQueue resource ID.
Note: The
application name is applicable only if the bean is packaged within
an EAR file.
- Optional: You can configure the wasJmsSecurity-1.0 feature
to enable the wasJmsServer-1.0 feature
work in a secure mode. For more information, see Enabling secure JMS messaging for the Liberty profile. The point-to-point
messaging is configured to send messages to a queue or to receive
messages from a queue.