Author |
Message
|
ofergal |
Posted: Sat Feb 26, 2005 10:06 am Post subject: Setting and Getting Message groupID in VB.NET (or C#) |
|
|
Newbie
Joined: 26 Feb 2005 Posts: 3 Location: BG IL
|
I am writing 1 program that puts pairs of messages on a Queue and another one that will read the group id of messages to detemain the pairs.
For the life of me I can't figure out how to read the groupID once I get the message from the queue.
Any one cares to help? _________________ Ofer Gal |
|
Back to top |
|
 |
jefflowrey |
Posted: Sat Feb 26, 2005 11:06 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Did you look to see if the groupID is part of the MQMD?
Did you look to see how to access parts of the MQMD in .NET? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
RogerLacroix |
Posted: Sat Feb 26, 2005 10:04 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
Hi,
I have moved this posting to the MQ API forum because it has nothing to do with any Capitalware product.
Regards,
Roger Lacroix
Capitalware Inc. _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
kirani |
Posted: Sat Feb 26, 2005 11:26 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Please do not post duplicate questions.
http://www.mqseries.net/phpBB2/viewtopic.php?t=20744
You need to use GET/SET Methods in MQMessage class to get/set Group Id. This is a binary field and it will return you byte[] array.
For more details please take a look at Using .NET manual. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
ofergal |
Posted: Sun Feb 27, 2005 6:39 am Post subject: What is the group ID |
|
|
Newbie
Joined: 26 Feb 2005 Posts: 3 Location: BG IL
|
I used everthing from the guide
When I create the message, I do:
Dim bytes() As Byte
Dim strGroup As String = "123"
Dim uni As New System.Text.UnicodeEncoding
mqMsg.GroupId = uni.GetBytes(strGroup)
and I see it on the explorer's Group ID Bytes column as 3100320033000000000000000000000000000
But when I get it from the queue with:
mqMsg = New MQMessage
mqGetMsgOpts = New MQGetMessageOptions
Try
mqQueue.Get(mqMsg, mqGetMsgOpts)
Dim uni As New System.Text.UnicodeEncoding
Dim strGroup As String
strGroup = uni.GetString(mqMsg.GroupId)
strGroup is "" and I tried other combinations and got nothing too
HELP! What am I doing wrong? _________________ Ofer Gal |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Feb 27, 2005 11:57 am Post subject: Re: What is the group ID |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
ofergal wrote: |
I used everthing from the guide
When I create the message, I do:
Dim bytes() As Byte
Dim strGroup As String = "123"
Dim uni As New System.Text.UnicodeEncoding
mqMsg.GroupId = uni.GetBytes(strGroup)
and I see it on the explorer's Group ID Bytes column as 3100320033000000000000000000000000000
But when I get it from the queue with:
mqMsg = New MQMessage
mqGetMsgOpts = New MQGetMessageOptions
Try
mqQueue.Get(mqMsg, mqGetMsgOpts)
Dim uni As New System.Text.UnicodeEncoding
Dim strGroup As String
strGroup = uni.GetString(mqMsg.GroupId)
strGroup is "" and I tried other combinations and got nothing too
HELP! What am I doing wrong? |
First and never enough repeated: YOU ARE DEALING WITH A BYTE ARRAY AND NOT A STRING!!!
What is the argument type of uni.GetString ?
Have you checked the MQMessage interface in .NET? Is there a different way to get at the GroupId like a getter method? Are you sure of the spelling (GroupID vs GroupId) etc ... case does matter!
I'd say check and double check your code. Check as well the message using any of the default tools like amq* to browse the message. It will write out the GroupID if it really made it on to the message.
Enjoy |
|
Back to top |
|
 |
jefflowrey |
Posted: Sun Feb 27, 2005 12:42 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Also,
http://publibfp.boulder.ibm.com/epubs/html/csqzak09/csqzak091k.htm#Header_273 wrote: |
Message groups and segments can be processed correctly only if the group identifier is unique. For this reason, applications should not generate their own group identifiers |
(Emphasis from the APR, not me).
And see http://publibfp.boulder.ibm.com/epubs/html/csqzak09/csqzak0920.htm#TBLPMOGRP _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
ofergal |
Posted: Mon Feb 28, 2005 8:58 am Post subject: No luck reading Group ID |
|
|
Newbie
Joined: 26 Feb 2005 Posts: 3 Location: BG IL
|
O.K. I manage to put pairs of messages that show same (manager assigened) group ID in the MQ explorer. (used the flags to do it)
I still have no success in reading what this ID is (so I can tell the pairs)
mqQueue.Get(mqMsg, mqGetMsgOpts)
Dim MyBytes() As Byte
MyBytes = mqMsg.GroupId
For i = 0 To 23 : Debug.Write(MyBytes(i).ToString) : Next
This should have given me what the groupid bytes are but it shows
000000000000000000000000
(in the explorer the column shows bunch of hexadiciml values)
(there is no spelling mistakes because I use the intelisense and the app compiles fine)
The actual payload of the message comes back fine, and is usable. _________________ Ofer Gal |
|
Back to top |
|
 |
dpchiesa |
Posted: Mon Mar 07, 2005 5:52 pm Post subject: try the debugger? |
|
|
 Apprentice
Joined: 29 May 2002 Posts: 46
|
what does it look like in the debugger?
What if you Base64 encode the byte array?
I don't know what System.Byte.ToString() is supposed to return. Maybe for control characters (out of ASCII Range) it returns '0' ? _________________ -dpchiesa |
|
Back to top |
|
 |
|