I'm brand new to WebSphere MQ. I'm using IBM's .NET classes (IBM.WMQ) to put a request message and then get a response message. The MQMessage object has a number of Writexxx methods for various data types. I need to write a variety of different data elements to the request message. My question is, should I call the appropriate Write method for each individual data element, or should I build the whole thing with a StringBuilder and then call the MQMessage WriteString method once?
+1
A:
The write APIs are to try an help you write clearer code, but whoever converted the WMQ API to .Net is an idiot.
They wrote 20 different APIs instead of a "write" function with overloads. The write call has a few usable overloads.
They created one enum which has 100's if not thousands of options called MQC (MQ Constants). Have fun, but beware of transactions on WMQ, as there is a *cough small cost involved in using that functionality.
Now that I'm done with my rant, beware of the APIs that most of the apis have a limitation of an signed int in terms of size, only the write(byte[] array) and the writestring(string s) function take a large message. Also the .net api writes all strings UTF-16 as per .net's implementation which may affect you.
Spence
2009-05-13 06:51:27
Thanks for the response (I was beginning to wonder if I was the only one using this stuff). So which would you do if you had a long message to write, multiple "write" method calls, or build your string and do a single WriteString call? Or is it better to write the byte array?
John M Gant
2009-05-13 14:16:14
Spence
2009-05-13 21:48:25