Another newb MQ Server question. I am building an ASP.NET C# application that needs to browse the message, save the message text to a database, and then read the message so it's removed from the queue. That way if the saving fails, the message is still in the queue and I don't have to ask it to be resent.
The problem is I need a way to uniquely identify the message when it is browsed so I can read (remove) it after a successful database save. I read about Correlation IDand MessageId and have trouble getting values.
The CorrelationId is always blank, so I can't use that. The messageId I cannot figure out how to convert it to something readable.
For example: MQ Explorer shows a messageID of: AMQ AZMEUNK62 bS Ý. MQ Explorer says the message ID bytes are: 414D512055534E4A5241523632202020126210532001DD02.
How do I convert the message ID bytes to that human readable string and back?
I've tried the code below which returns unusable result (AMQ AZMEUNK62 ↕b►S ☺?☻)
string msgIdStr = System.Text.Encoding.Default.GetString(mqMessage.MessageId);
string strMsgId = Encoding.UTF8.GetString(mqMessage.MessageId, 0, mqMessage.MessageId.Length);
I tried these methods because of these posts-
How to convert byte[] to string?
Any thoughts most welcome.