How to read first 10 messages in the Queue - Websphere

This is a discussion on How to read first 10 messages in the Queue - Websphere ; Hi, I wants to read the first 10 messages out of 100 messages available in the Queue using mQ series and wants to post these 10 messages to other Queue. /****My code is as folows Start ****/ MQGetMessageOptions gmo = ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: How to read first 10 messages in the Queue

  1. How to read first 10 messages in the Queue

    Hi,
    I wants to read the first 10 messages out of 100 messages available in the Queue using mQ series and wants to post these 10 messages to other Queue.

    /****My code is as folows Start ****/
    MQGetMessageOptions gmo = new MQGetMessageOptions();
    gmo.options = MQC.MQGMO_LOGICAL_ORDER | MQC.MQGMO_ALL_MSGS_AVAILABLE;
    gmo.matchOptions = MQC.MQMO_NONE;
    /****My code is as folow End ****/

    MQGMO_ALL_MSGS_AVAILABLE is getting all the messages in one instance

    How can proceed to get only 10 messages.

    Please suggest in resolving the same..Thanks in advance

    Thanks
    Satya..

  2. Re: How to read first 10 messages in the Queue

    {code}
    msgs = 0 /* Count of messages retrieved within UOW */

    /* Retrieve remaining messages in the group */
    do while ( GroupStatus == MQGS_MSG_IN_GROUP )

    /* Process up to 10 messages in the group */
    GMO.Options = MQGMO_SYNCPOINT | MQGMO_WAIT | MQGMO_LOGICAL_ORDER
    do while ( (GroupStatus == MQGS_MSG_IN_GROUP) && (msgs 10) )
    MQGET msgs = msgs + 1
    /* Process this message */
    ...
    /* end while */

    /* end while */
    {code}

+ Reply to Thread