ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » General IBM MQ Support » How do you capture the MsgId of a msg that you've browsed?

Post new topic  Reply to topic
 How do you capture the MsgId of a msg that you've browsed? « View previous topic :: View next topic » 
Author Message
manjo
PostPosted: Thu Sep 29, 2005 6:26 pm    Post subject: How do you capture the MsgId of a msg that you've browsed? Reply with quote

Novice

Joined: 29 Nov 2001
Posts: 15

I'm using perl/MQSeries.pm

I'm unable to GET a message for a specific MsgId. I can read the messages on the queue just fine when not looking for a specific msg (i.e. using MQMO_NONE, and not setting MsgId). Part of my debugging is that I'd like to BROWSE the messages on the queue and capture their MsgId's so that I can ensure that I MQPUT them on the queue with a MsgId in the first place. Is there a way to do that?

In any event, my relevant MQGET code is this:

my $MsgId = "24818_31_3 test jfmiazzz";

$NextGetMsgOpts = {
MatchOptions => MQMO_MATCH_MSG_ID,
Options => MQGMO_NO_WAIT | MQGMO_CONVERT | MQGMO_BROWSE_NEXT
};

$GMsgDesc = {
MsgId=>$MsgId
};

$buffer = MQGET($Hcon,
$Hobjget,
$GMsgDesc,
$NextGetMsgOpts,
$buflen,
$CompCode,
$GReason);


foreach $key (keys %$GMsgDesc)
{
print "$key: %$GMsgDesc->{$key}\n";
}

($ReasonText) = MQReasonToText($GReason);
print " MQGET failed CompCode = $CompCode, $ReasonText -->\n";

END OF CODE EXCERPT

OUTPUT excerpt:
MsgId: %24818_31_3 test jfmiazzz
MQGET failed CompCode = 2, No message available. -->




Any suggestions would be appreciated.

Thanks,
Margaret
Back to top
View user's profile Send private message
hopsala
PostPosted: Thu Sep 29, 2005 7:40 pm    Post subject: Reply with quote

Guardian

Joined: 24 Sep 2004
Posts: 960

manjo wrote:
Part of my debugging is that I'd like to BROWSE the messages on the queue and capture their MsgId's so that I can ensure that I MQPUT them on the queue with a MsgId in the first place. Is there a way to do that?

That was quite an unclear explanation... after reading a few times I figured this out - you want to put msgs with certain msgid, and then browse the q to make sure you set the msgid properly - right?
There's no ready way to do this, you just have to code it, in the exact same manner that you already are - MQGET from the queue with MATCH_MSG_ID after each MQPUT. But I don't really see why you need to do this, what exactly do you mean by "part of my debugging"?

manjo wrote:
I'm unable to GET a message for a specific MsgId. I can read the messages on the queue just fine when not looking for a specific msg (i.e. using MQMO_NONE, and not setting MsgId).

I'm not very big on Perl, but maybe you should reset your CorrlID, both in the beginning and in your loop.
Back to top
View user's profile Send private message
EddieA
PostPosted: Thu Sep 29, 2005 7:44 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Quote:
capture their MsgId's so that I can ensure that I MQPUT them on the queue with a MsgId in the first place.

Actually, it's impossible to put a message without a MessageID. Because if you don't supply one, MQ generates one for you.
Quote:
my $MsgId = "24818_31_3 test jfmiazzz";

MessageIDs are not character. They are bytes. Search the forum for a whole bunch of posts explaining why treating them as characters is bad.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » How do you capture the MsgId of a msg that you've browsed?
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.