General principles for point-to-point messaging using ASF

Use this topic for general information about point-to-point messaging using ASF.

When an application creates a ConnectionConsumer from a QueueConnection object, it specifies a JMS queue object and a selector string. The ConnectionConsumer then begins to provide messages to sessions in the associated ServerSessionPool. Messages arrive on the queue, and if they match the selector, they are delivered to sessions in the associated ServerSessionPool.

In IBM MQ terms, the queue object refers to either a QLOCAL or a QALIAS on the local queue manager. If it is a QALIAS, that QALIAS must refer to a QLOCAL. The fully resolved IBM MQ QLOCAL is known as the underlying QLOCAL. A ConnectionConsumer is said to be active if it is not closed and its parent QueueConnection is started.

It is possible for multiple ConnectionConsumers, each with different selectors, to run against the same underlying QLOCAL. To maintain performance, unwanted messages must not accumulate on the queue. Unwanted messages are those for which no active ConnectionConsumer has a matching selector. We can set the QueueConnectionFactory so that these unwanted messages are removed from the queue (for details, see Removing messages from the queue in ASF ). We can set this behavior in one of two ways:

  • Use the JMS administration tool to set the QueueConnectionFactory to MRET(NO).
  • In your program, use:
    MQQueueConnectionFactory.setMessageRetention(WMQConstants.WMQ_MRET_NO)
    
If we do not change this setting, the default is to retain such unwanted messages on the queue. When you set up the IBM MQ queue manager, consider the following points:

  • The underlying QLOCAL must be enabled for shared input. To do this, use the following MQSC command:
    ALTER QLOCAL( your.qlocal.name ) SHARE GET(ENABLED)
    
  • Your queue manager must have an enabled dead-letter queue. If a ConnectionConsumer experiences a problem when it puts a message on the dead-letter queue, message delivery from the underlying QLOCAL stops. To define a dead-letter queue, use:
    ALTER QMGR DEADQ( your.dead.letter.queue.name )
    
  • The user that runs the ConnectionConsumer must have authority to perform MQOPEN with MQOO_SAVE_ALL_CONTEXT and MQOO_PASS_ALL_CONTEXT. For details, see the IBM MQ documentation for your specific platform.
  • If unwanted messages are left on the queue, they degrade the system performance. Therefore, plan your message selectors so that between them, the ConnectionConsumers will remove all messages from the queue.
For details about MQSC commands, see MQSC commands.