Java: Different message property data type returned
From IBM® WebSphere® MQ 7.1, if the data type of a message property is set, the same data type is returned when the message is received. This is different from IBM WebSphere MQ 7.0.1, where in some circumstances properties set with a specific type were returned with the default type String.
The change affects Java applications that used the MQRFH2 class, and retrieved properties using the getFieldValue
method.
You can write a message property in Java using a method such as setIntFieldValue
. In IBM
WebSphere MQ 7.0.1 the property is written into an MQRFH2
header with a default type of String. When you retrieve the property with the getFieldValue
method, a String object is returned.
The change is that now the correct type of object is returned, in this example the type of object returned is Integer.
If your application retrieves the property with the getIntFieldValue
method, there is no change in behavior; an int is returned. If property is written to the MQRFH2
header by some other means, and the data type is set, then getFieldValue
returns the correct type of object.