Posted: Wed Feb 18, 2004 3:41 pm Post subject: .NET struct for MQTMC2 in WebSphere MQ 5.2 and greater
Novice
Joined: 06 Jul 2002 Posts: 17
Hi All,
in the .NET classes for WebSphere MQ what is the equivalient structure of MQTMC2. I am planning to use the Trigger Monitor from IBM which will start my application. but I couldn't get a .NET structure similar to MQTMC2 in VC++. Could someone help me know how can my application know which Queue Manager + Queue Name was the trigger raised on?
The .net interface doesnt provide such an interface (neither does Java?) and hence you will need to do it yourself. The structure isnt 'complex' but its something like (Untested...)
public MQTrigger(string mqtmc2)
{
if (null == mqtmc2 || SIZEOF_MQTMC2 != mqtmc2.Length)
throw new Exception("Invalid MQTMC2 Structure");
MemoryStream memoryStream = new MemoryStream();
BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
BinaryReader binaryReader = new BinaryReader(memoryStream);
binaryWriter.Write(mqtmc2.ToCharArray(0, mqtmc2.Length)); // Write Trigger Data to struct
memoryStream.Seek(0, SeekOrigin.Begin); // Seek to begining of stream
trig.strucId = binaryReader.ReadBytes(4); // Struct ID
trig.version = binaryReader.ReadBytes(4); // Struct Version
trig.qName = binaryReader.ReadBytes(4; // Queue Name
trig.processName = binaryReader.ReadBytes(4; // Process Name
trig.triggerData = binaryReader.ReadBytes(64); // Trigger Data
trig.applType = binaryReader.ReadBytes(4); // Application Type
trig.applId = binaryReader.ReadBytes(256); // Application Identifier
trig.envData = binaryReader.ReadBytes(128); // Environment Data
trig.userData = binaryReader.ReadBytes(128); // User Data
trig.qMgrName = binaryReader.ReadBytes(4; // Queue Manager Name
}
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