Posted: Tue Nov 15, 2005 10:03 am Post subject: AMQMDNET Message issue
Novice
Joined: 15 Nov 2005 Posts: 15
Environment: Win2K, C# program referencing AMQMDNET.dll
Looks like IBM folks forgot to (or didn't want to) port the MessageIdHex property of MQMessage (IBM.WMQAX namespace) to their .Net counterpart implementation (IBM.WMQ namespace).
Posted: Thu Nov 17, 2005 6:01 am Post subject: Got workaround
Novice
Joined: 15 Nov 2005 Posts: 15
Upon further investigation (using ildasm to look at IL in IBM.WMQAX) it turns out MessageIdHex is simply a method to convert the MessageId (byte[]) to string. I should have thought of that since MessageIdHex is not in the MQMD structure... Anyway, if anyone is interested here's a raw version of a utility class I wrote to perform the conversion (sorry for the formatting in this editor)
Code:
internal sealed class MQUtility
{
static private readonly MQMessage dummyMessage = new MQMessage();
static private readonly int MQMessageIdLen = dummyMessage.MessageId.GetLength(0);
internal static string MessageIdHex(MQMessage msg)
{
StringBuilder sb = new StringBuilder(MQMessageIdLen * 2); // hex representation of each byte; 2 digit wide
foreach(byte b in msg.MessageId)
{
sb.AppendFormat("{0,2:X}", b);
}
return sb.ToString();
}
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