Author |
Message
|
ivanachukapawn |
Posted: Fri Feb 17, 2006 8:29 am Post subject: produced with either writeUTF or writeString - which is it? |
|
|
 Knight
Joined: 27 Oct 2003 Posts: 561
|
Our application consumes messages from multiple messaging producing applications which are COTS ("commercial off-the-shelf") and therefore beyond our control. Our consuming application wishes to dequeue the messages and then do a readLine. What method could be used to determine if the message content received contains the 2 byte length code which is prefixed when the message has been produced using writeUTF? |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Feb 19, 2006 9:17 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Typically you should be able to distinguish by message type.
A message containing text but no UTF8 should be of format MQSTR and thus map to a TextMessage.
A message containing UTF8 should not have the format set to MQSTR as there is no need to translate accross CCSIDs. Thus you would receive it as a BytesMessage and use the read UTF8 method on it.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
EddieA |
Posted: Sun Feb 19, 2006 10:41 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Quote: |
What method could be used to determine if the message content received contains the 2 byte length code |
Take a look at the message with something like amqsbcg.
From an application, if the Format is MQSTR, then it should should be writeString. If it isn't MQSTR, then there's no easy way to tell.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
zpat |
Posted: Sun Feb 19, 2006 11:03 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
UTF-8 messages can also be of format MQSTR, otherwise how would a mainframe convert the message to EBCDIC for example? |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Feb 19, 2006 5:25 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
I think the true question is why would you want to convert a UTF-8 message to EBCDIC?
a) You went to great length to write the message not as a standard String but as a UTF-8 String....
b) You would probably be expected to read it as a UTF-8 String even on an EBCDIC platform. So why go to the extent of converting twice ?
You would probably have to run a test to check whether the write UTF-8 method and adding the MQSTR format can even be read from JMS as a TextMessage. You might get some exception when trying TextMessage.getString().
In the best of cases you won't see any difference. In the worst of cases you won't be able to read the content of the UTF-8 message from a TextMessage but have to cast to a BytesMessage and use readUTF-8.
Enjoy
 _________________ MQ & Broker admin |
|
Back to top |
|
 |
|