Author |
Message
|
shamcs |
Posted: Thu Dec 09, 2010 11:46 pm Post subject: help to get message id |
|
|
Novice
Joined: 09 Dec 2010 Posts: 10
|
hye there..
i have a problem to get message id from queue message..
its in byte how do i convert it to string..??
this is my code...
queueManager = new MQQueueManager(queueManagerName, channelName, connectionName);
queue = queueManager.AccessQueue(queueName, MQC.MQOO_BROWSE + MQC.MQOO_FAIL_IF_QUIESCING);
MQMessage queueMessage = new MQMessage(); queueMessage.Format = MQC.MQFMT_STRING;
MQGetMessageOptions queueGetMessageOptions = new MQGetMessageOptions(); queueGetMessageOptions.Options = MQC.MQGMO_NO_SYNCPOINT + MQC.MQGMO_CONVERT + MQC.MQGMO_NO_WAIT + MQC.MQGMO_FAIL_IF_QUIESCING + MQC.MQGMO_BROWSE_NEXT;
queue.Get(queueMessage, queueGetMessageOptions);
messageId = queueMessage.MessageId;
what should i do to get message id for every message retrieve.??
thanks for help.. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Dec 10, 2010 2:48 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
The message ID is not a string.
It should not be treated as a string, nor hold string data. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Dec 10, 2010 7:26 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
If you do need a string (because defined as such in a DB ...etc...) you can use the hex representation of the byte array.
As jeff advised however the true content of the field is a byte[] and not a string. Most important it may have C string terminators in it and still have significant values after that...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Dec 10, 2010 7:36 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
fjb_saper wrote: |
Most important it may have C string terminators in it and still have significant values after that... |
Most importantly it may contain any value at all and have no meaning in any codepage at all or be illegal in the codepage that it is "expected" to be in. |
|
Back to top |
|
 |
bruce2359 |
Posted: Fri Dec 10, 2010 9:08 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9471 Location: US: west coast, almost. Otherwise, enroute.
|
MsgId, CorrelId and GroupId, are defined as WMQ data type BYTE24 - 24 bytes - and not 24 characters. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
shamcs |
Posted: Sat Dec 11, 2010 8:25 am Post subject: |
|
|
Novice
Joined: 09 Dec 2010 Posts: 10
|
okie, so i get it...message id is not a string...
so, any idea how do i read it using c# langguage..??
(sorry to ask this, because i have no idea how to do that.)
thanks  |
|
Back to top |
|
 |
bruce2359 |
Posted: Sat Dec 11, 2010 8:57 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9471 Location: US: west coast, almost. Otherwise, enroute.
|
Why do you want to read it? The usual function of MsgId is for the requesting app ask the qmgr to populate the field; then the replying app moves MsgId to CorrelId in the reply message. The requesting app then waits for the CorrelId of the reply that matches the MsgId of the request.
Why do you need to read the MsgId? For what purpose, other than curiosity? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
Vitor |
Posted: Sat Dec 11, 2010 9:58 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
shamcs wrote: |
so, any idea how do i read it using c# langguage..??
|
As has been asked before, why? There's no good reason to do this. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Sat Dec 11, 2010 10:03 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
The job of being a programmer is to read documentation, understand what it says, and apply it to the construction of software. |
|
Back to top |
|
 |
bruce2359 |
Posted: Sat Dec 11, 2010 12:09 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9471 Location: US: west coast, almost. Otherwise, enroute.
|
Curiosity is an excellent reason to discover anything and everything.
Now you know that MsgId is not a character field. If it were, and it contained only printable characters, you could just print the 24 bytes.
But since you now know that MsgId is 24 byte long string of bits (and not characters), you can use any utility available on your platform to transform/translate the bytes of bits to their hex/ascii equivalents.
A quick search of google for 'convert hex to ascii in c' offered some coding examples. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
shamcs |
Posted: Sat Dec 11, 2010 2:54 pm Post subject: |
|
|
Novice
Joined: 09 Dec 2010 Posts: 10
|
my client want me to create one application because they want to see for each transaction that use this thing is work..
sound weird because of course it is work if the transaction is done..lol.
but it is true, they just dont believe it just like that(maybe they only believe on GUI thing).. and forse me to create this application...
so my idea want to show message ID because each successfully transaction have 1 message id and 4 message ...
so i just want to show to them(my client) that we(my company) not lie to them....
anyway thank for help guys...so i just need to figure out how to convert hex to ascii ..
monday i'll back for work and try it out..
Thanks..  |
|
Back to top |
|
 |
bruce2359 |
Posted: Sat Dec 11, 2010 3:31 pm Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9471 Location: US: west coast, almost. Otherwise, enroute.
|
How did you arrive at this solution?
Exactly how will showing the client the contents of the MsgId convince them that WMQ is working?
Why can't you use the supplied utilities (like amqsbcg) to display the message (MQMD and some of the message data) as the message sits in the queue?
Are you certain that you understand exactly what the client wants? Are you certain that the client understands exactly what he/she wants? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
shamcs |
Posted: Sun Dec 12, 2010 5:47 am Post subject: |
|
|
Novice
Joined: 09 Dec 2010 Posts: 10
|
sigh..this are the problems
..they are not understand what im said.. they suspect that the transactions are not clear..and argue with me...
so my solution is just a simple application that get message id and message that sit in que(for one complete transaction) .... and manipulate it like a animation..
so they will understand for each complete transaction have different message and same messageID(1 message ID, 4 message)..
just like that..
(really waste of time..sigh..)
thanks anyway bruce... |
|
Back to top |
|
 |
bruce2359 |
Posted: Sun Dec 12, 2010 7:27 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9471 Location: US: west coast, almost. Otherwise, enroute.
|
The contents of the MsgId field in the MQMD is set by the application - by the programmer. The programmer can ask the qmgr to set the MsgId so that a unique MsgId is created for each individual message. _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
shamcs |
Posted: Sun Dec 12, 2010 5:14 pm Post subject: |
|
|
Novice
Joined: 09 Dec 2010 Posts: 10
|
yes i know bruce...so my question is solve..i manage to get message id and convert it to string....
thanks all..  |
|
Back to top |
|
 |
|