Rico Strydom
Rico Strydom

Reputation: 549

Websphere MQ message purged (destructive read) instead of browsed

I am trying to Browse a message on a queue. For some reason the message is purged/removed (destructive read) instead of being browsed.

This are my OpenOptions:

int openOptions2 = CMQC.MQOO_INPUT_AS_Q_DEF
                 | CMQC.MQOO_FAIL_IF_QUIESCING
                 | CMQC.MQOO_INQUIRE
                 | CMQC.MQOO_BROWSE;

And this is my GetOptions:

qMQGetMessageOptions.options = CMQC.MQGMO_NO_WAIT | CMQC.MQGMO_BROWSE_FIRST;

What am I doing wrong?

Upvotes: 1

Views: 449

Answers (1)

Roger
Roger

Reputation: 7476

Try:

int openOptions2 = CMQC.MQOO_FAIL_IF_QUIESCING | CMQC.MQOO_INQUIRE | CMQC.MQOO_BROWSE;

And:

MQMessage getMsg;
qMQGetMessageOptions.options = CMQC.MQGMO_NO_WAIT | CMQC.MQGMO_BROWSE_FIRST;

while (true)
{
   getMsg = new MQMessage();
   inQ.get(getMsg, qMQGetMessageOptions);
   qMQGetMessageOptions.options = CMQC.MQGMO_NO_WAIT | CMQC.MQGMO_BROWSE_NEXT;
}

Upvotes: 3

Related Questions