Configuring point-to-point messaging for a single Liberty server

You can configure point-to-point messaging such as sending of messages to a queue or receiving of messages from a queue.

About this task

The examples in the following steps show the server.xml file configuration for point-to-point messaging for a single Liberty server.

Procedure

  1. Enable the messaging features. 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-2.0</feature>
       <feature>jndi-1.0</feature>
    </featureManager>
  2. 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>
  3. 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"/>
  4. 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>
  5. Declare an activation specification for the message-driven beans that are deployed on Liberty. 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.
  6. 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 Liberty.
    The point-to-point messaging is configured to send messages to a queue or to receive messages from a queue.