ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » produced with either writeUTF or writeString - which is it?

Post new topic  Reply to topic
 produced with either writeUTF or writeString - which is it? « View previous topic :: View next topic » 
Author Message
ivanachukapawn
PostPosted: Fri Feb 17, 2006 8:29 am    Post subject: produced with either writeUTF or writeString - which is it? Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Sun Feb 19, 2006 9:17 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
EddieA
PostPosted: Sun Feb 19, 2006 10:41 am    Post subject: Reply with quote

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
View user's profile Send private message
zpat
PostPosted: Sun Feb 19, 2006 11:03 am    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Sun Feb 19, 2006 5:25 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » produced with either writeUTF or writeString - which is it?
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.