|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
unable to get the message from the queue completely |
« View previous topic :: View next topic » |
Author |
Message
|
asr2002 |
Posted: Mon Oct 28, 2002 9:41 am Post subject: unable to get the message from the queue completely |
|
|
Novice
Joined: 09 Sep 2002 Posts: 13
|
Hi guys!!!
i put a message in a queue and get the message using the message id... so i need to browse and then get the message... below code is working fine, ie. i'm able to browse and get the requied message and output the message, but i'm unable to get the message completely from the queue once it is found.... my question is , do i need to set any gmo or pmo options to get the message from the queue...
i really appreciate ur inputs...
Thanks
MQMessage retrievedMessage = new MQMessage();
byte[] rMsgId1 = new byte[24];
String rMsgId = new String(sMsgId);
rMsgId1 = rMsgId.getBytes();
retrievedMessage.clearMessage();
retrievedMessage.correlationId = MQC.MQCI_NONE;
retrievedMessage.messageId = MQC.MQMI_NONE;
retrievedMessage.messageId = rMsgId1;
// Set the get message options...
MQGetMessageOptions gmo = new MQGetMessageOptions();
gmo.options = MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_FIRST;
//gmo.matchOptions = MQC.MQMO_MATCH_MSG_ID;
// get the message off the queue...
getQueue.get(retrievedMessage, gmo);
// String sMsg = retrievedMessage.readString(retrievedMessage.getMessageLength());
sMsg = retrievedMessage.readString(retrievedMessage.getMessageLength());
// String msgText = retrievedMessage.readUTF();
System.out.println("The Get Message is: " + sMsg);
gmo.options = MQC.MQGMO_WAIT | MQC.MQGMO_BROWSE_NEXT;
// Close the queue...
getQueue.close();
} catch (MQException mqe) {
System.out.println(mqe.getMessage());
} |
|
Back to top |
|
 |
PeterPotkay |
Posted: Mon Oct 28, 2002 4:03 pm Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
What error code is MQ returning to you when you try to get the message? _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
asr2002 |
Posted: Tue Oct 29, 2002 8:16 pm Post subject: |
|
|
Novice
Joined: 09 Sep 2002 Posts: 13
|
sorry, for confusion... i'm not saying i'm getting an error... actually my question is say when i have 10 messages in a queue, i need to get the required msg based on msgid... so what i do is i browse and get the particular msg... but what is happening is i'm able to print my get msg, but it is not delteing in the queue... some now it is working now i used options :MQC.MQGMO_MSG_UNDER_CURSOR
thanks, for ur response |
|
Back to top |
|
 |
bduncan |
Posted: Tue Oct 29, 2002 11:10 pm Post subject: |
|
|
Padawan
Joined: 11 Apr 2001 Posts: 1554 Location: Silicon Valley
|
If you know what message you're looking for beforehand, why even do the browse? If you are matching on message id, just use this as the matching parameter in the gmo options and do a regular MQGET. This should both find the message you desire and remove it from the queue. _________________ Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|