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 » IBM MQ API Support » Setting and Getting Message groupID in VB.NET (or C#)

Post new topic  Reply to topic
 Setting and Getting Message groupID in VB.NET (or C#) « View previous topic :: View next topic » 
Author Message
ofergal
PostPosted: Sat Feb 26, 2005 10:06 am    Post subject: Setting and Getting Message groupID in VB.NET (or C#) Reply with quote

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
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Sat Feb 26, 2005 11:06 am    Post subject: Reply with quote

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
View user's profile Send private message
RogerLacroix
PostPosted: Sat Feb 26, 2005 10:04 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
kirani
PostPosted: Sat Feb 26, 2005 11:26 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
ofergal
PostPosted: Sun Feb 27, 2005 6:39 am    Post subject: What is the group ID Reply with quote

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
View user's profile Send private message Send e-mail
fjb_saper
PostPosted: Sun Feb 27, 2005 11:57 am    Post subject: Re: What is the group ID Reply with quote

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
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Sun Feb 27, 2005 12:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
ofergal
PostPosted: Mon Feb 28, 2005 8:58 am    Post subject: No luck reading Group ID Reply with quote

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
View user's profile Send private message Send e-mail
dpchiesa
PostPosted: Mon Mar 07, 2005 5:52 pm    Post subject: try the debugger? Reply with quote

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
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 » IBM MQ API Support » Setting and Getting Message groupID in VB.NET (or C#)
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.