Author |
Message
|
fcotait |
Posted: Mon May 20, 2002 5:09 am Post subject: Getting specific message |
|
|
 Acolyte
Joined: 28 Feb 2002 Posts: 63 Location: Sao Paulo - Brazil
|
How I make the Get of a specific message?
For example, I have 20 messages in a queue and want to remove the first one, fifth and tenth, using the MsgId.
Thanks |
|
Back to top |
|
 |
PeterPotkay |
Posted: Mon May 20, 2002 7:39 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
If you know what the MessagIDs of the messages are (i.e. message #10 on the queue had an ID of ABCDEFG10), then before the put, set the CorrelID in the MQMD to nulls and set the MessagID to ABCDEFG10. This will insure you are only returned a message with that MessageID (message #10). _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
fcotait |
Posted: Mon May 20, 2002 12:37 pm Post subject: |
|
|
 Acolyte
Joined: 28 Feb 2002 Posts: 63 Location: Sao Paulo - Brazil
|
I am using the MsgId and CorrelId. He will be that I am opening the Line correctly?
Return Reason 2033.
Below this part of codigo in Visual Basic
Thanks
---------------------------------------------------------------------------------
MQOD_DEFAULTS od
od.ObjectName = "QM.TEST"
OpenOptions = MQOO_INPUT_AS_Q_DEF
MQOPEN gHcon, od, OpenOptions, gHobj, cCode, Reason
MQGMO_DEFAULTS gmo
MQMD_DEFAULTS md
gmo.Options = MQGMO_NO_WAIT + MQGMO_ACCEPT_TRUNCATED_MSG + MQGMO_SYNCPOINT
md.MsgId = "414D5120514D2E424C412020202020207314E13C72F00000"
md.CorrelId = MQCI_NONE
MQGET gHcon, gHobj, md, gmo, bufLenGet, bufMsgGet, lenMsgGet, cCode, Reason |
|
Back to top |
|
 |
PeterPotkay |
Posted: Tue May 21, 2002 4:19 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
try adding +MQ.MQMO_MATCH_MSG_ID to your gmo.Options
For some reason, my VB app needs to specify this option if I want to match on a MessageID (or CorrelID (MQ.MQMO_MATCH_CORREL_ID)), but my COBOL apps only need to fill in the MSG_ID or CORREL_ID field with what they want to match on.
And insure that there is a message with that ID on the queue that is not expired and is commited if it was MQPUT under syncpoint. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
fcotait |
Posted: Tue May 21, 2002 12:08 pm Post subject: |
|
|
 Acolyte
Joined: 28 Feb 2002 Posts: 63 Location: Sao Paulo - Brazil
|
It did not function. It is a so simple process that I do not know nor what to make, in my applications in C I function
Any idea is coming well |
|
Back to top |
|
 |
nethaji |
Posted: Tue May 21, 2002 12:40 pm Post subject: |
|
|
 Apprentice
Joined: 23 Jul 2001 Posts: 26 Location: Virginia
|
msgID is a byte variable. Looks like you are trying to pass a string to it. Will this be a problem?? try to pass byte value to it.
regards
Subash |
|
Back to top |
|
 |
fcotait |
Posted: Wed May 22, 2002 9:12 am Post subject: |
|
|
 Acolyte
Joined: 28 Feb 2002 Posts: 63 Location: Sao Paulo - Brazil
|
In VB MsgId variable is a String type in CMQB module
Type MQMD
......
MsgId As String * 24 'Message identifier'
.....
End Type
it does not have as to pass an variable of the type Byte.
they alem of this, Byte type in the VB goes of 0 the 255 |
|
Back to top |
|
 |
jhalstead |
Posted: Wed May 22, 2002 11:53 pm Post subject: |
|
|
 Master
Joined: 16 Aug 2001 Posts: 258 Location: London
|
I think this has already been answered however in your code sample you're setting the string to "414D5120514D2E424C412020202020207314E13C72F00000" this is 48 characters long. This is the hex representation fo the message ID. You need to set the string to the ascii equivalent of this hex. As you point out MQMD.MsgId is a 24 byte field. Just so you know the first 12 bytes are based on the source queue manager, in this case AMQ QM.BLA, the last 12 bytes are part of a unique sequence number run.
It could be you're on the right track my VB knowledge is limited.
Jamie |
|
Back to top |
|
 |
MillsPerry |
Posted: Thu May 23, 2002 9:01 am Post subject: |
|
|
 Acolyte
Joined: 08 Oct 2001 Posts: 59 Location: ZyQuest, inc.
|
You need to set MQGMO.MatchOptions to MQMO_MQMO_MATCH_MSG_ID, not MQGMO.Options. |
|
Back to top |
|
 |
|