Enabling and disabling read ahead

By default read ahead is disabled. You can enable read ahead at queue or application level.

About this task

When you call MQOPEN with MQOO_READ_AHEAD, the IBM® MQ client only enables read-ahead if certain conditions are met. These conditions include:
  • Both the client and remote queue manager must be at IBM WebSphere® MQ 7.0 or later.
  • The client application must be compiled and linked against the threaded IBM MQ MQI client libraries.
  • The client channel must be using TCP/IP protocol
  • The channel must have a non-zero SharingConversations (SHARECNV) setting in both the client and server channel definitions.
To enable read ahead:
  • To configure read ahead at the queue level set the queue attribute, DEFREADA to YES.
  • To configure read ahead at the application level:
    • to use read ahead wherever possible use the MQOO_READ_AHEAD option on the MQOPEN function call. It is not possible for the client application to use read ahead if the DEFREADA queue attribute has been set to DISABLED.
    • to use read ahead only when read ahead is enabled on a queue, use the MQOO_READ_AHEAD_AS_Q_DEF option on the MQOPEN function call.
If a client application design is not suited to read ahead you can disable it:
  • at the queue level by setting the queue attribute, DEFREADA to NO if you do not want read ahead to be used unless it is requested by a client application, or DISABLED if you do not want read ahead to be used regardless of whether read ahead is required by a client application.
  • at the application level by using the MQOO_NO_READ_AHEAD option on the MQOPEN function call.
Two MQCLOSE options allow you to configure what happens to any messages that are being stored in the read ahead buffer if the queue is closed.
  • Use MQCO_IMMEDIATE to discard messages in the read ahead buffer.
  • Use MQCO_QUIESCE to ensure that messages in the read ahead buffer are consumed by the application before the queue is closed. When MQCLOSE with the MQCO_QUIESCE is issued and there are messages remaining on the read ahead buffer, MQRC_READ_AHEAD_MSGS returns with MQCC_WARNING.