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 » Trouble building large JMS TextMessage

Post new topic  Reply to topic
 Trouble building large JMS TextMessage « View previous topic :: View next topic » 
Author Message
veda7
PostPosted: Wed Jun 01, 2011 8:55 am    Post subject: Trouble building large JMS TextMessage Reply with quote

Newbie

Joined: 01 Jun 2011
Posts: 4

I have trouble building JMS Messages. I am using JMS with MQSeries, I have to build text messages of length more than 5000 characters, spaces are left in the message number type as zeros and string type as spaces to accomodate result so that we can see reply message will have those left gaps are filled with search results.

For e.g: Sending customer details as input and want to display details of products purchased.

Message structure:
CustomerId 25 chars
CustName 50 chars
Location 50 chars
StartDate 7 chars
EndDate 7 chars
ProductId
ProdcutQty
Price
ProductyType
ProductWeight
................
................

I am not building a JMS TextMessage with a big string(using StringBuffer or String), because to extract the result from the reply message will be awkward. so I am setting each as an input property as

message.setIntProperty("CustomerId");
message.setStringProperty("CustomerName");
---------------------
---------------------

So once receiving reply message I want to grab results like
message.getStringProperty(ProductId);
message.getStringProperty(ProductQty);
message.getStringProperty(Price);
----------------------
----------------------

problem: Once the Message is reached Queue, It doesn't contain Text.
message.getText() is zero as I didn't set Text for the message(I am not sending request message as a big string)
Queue Messages are expected to be in fixed lenth, for eg: 5000 chars.

Could any one have better idea, how can I implement this? I appreciate your help.

Thank you
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jun 01, 2011 9:02 am    Post subject: Re: Trouble building large JMS TextMessage Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

veda7 wrote:
problem: Once the Message is reached Queue, It doesn't contain Text.
message.getText() is zero as I didn't set Text for the message(I am not sending request message as a big string)
Queue Messages are expected to be in fixed lenth, for eg: 5000 chars.


I'm confused - you're clearly aware you're not setting any text in the message (from the above quote) yet you seem to think it should be 5000 characters long without it being set. What am I missing?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Jun 01, 2011 9:43 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

I'm confused as well.

You appear to be trying to populate the body of your message by setting a large number of Message Properties, rather than setting the body of your message.
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jun 01, 2011 10:05 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

mqjeff wrote:
You appear to be trying to populate the body of your message by setting a large number of Message Properties, rather than setting the body of your message.




But feared saying something stupid because there was a Java-ish reason for doing that.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
veda7
PostPosted: Wed Jun 01, 2011 11:23 am    Post subject: Reply with quote

Newbie

Joined: 01 Jun 2011
Posts: 4

mqjeff wrote:
I'm confused as well.

You appear to be trying to populate the body of your message by setting a large number of Message Properties, rather than setting the body of your message.


Hi mqjeff, thanks for replying.

I thought, TextMessage can be built in two ways

1.message.setText("------Large Text----")
2.message.setStringProprety() and other data type of set methods.

I have requirement of sending a text of around 5000 chars, in which I am supposed to leave blanks(zeros for Number type, spaces for String type), In the reply message these blanks will be filled up with search-results.
eg: C100CUSTNAME_______________________________CHICAGO__________20________000000000000000__________________
(Reply Message will be full text, search results will occupy thse blank spaces/zeros)

As it is very large text, It is hard to process the reply message to extract the search-results from the message. So is it only the way to send a large message through message.setText() method?

Thank you
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Jun 01, 2011 11:28 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

setStringProperty does not do the same thing as setText.

One creates a message property that is a string type, and one sets the body of the message.

You certainly CAN put all of your actual message data into message properties, rather than creating the fixed length document that you are trying to avoid creating.

But it may not produce the same message on the other end that the person who will read it is expecting to see.
Back to top
View user's profile Send private message
veda7
PostPosted: Wed Jun 01, 2011 11:38 am    Post subject: Re: Trouble building large JMS TextMessage Reply with quote

Newbie

Joined: 01 Jun 2011
Posts: 4

Vitor wrote:
veda7 wrote:
problem: Once the Message is reached Queue, It doesn't contain Text.
message.getText() is zero as I didn't set Text for the message(I am not sending request message as a big string)
Queue Messages are expected to be in fixed lenth, for eg: 5000 chars.


I'm confused - you're clearly aware you're not setting any text in the message (from the above quote) yet you seem to think it should be 5000 characters long without it being set. What am I missing?


Vitor, thank you too for responding. To process a large message where request has only inputs and reply message has input params plus output results. I am stuck to find a good way handle this type of messages.
For eg:
Request Msg:Param1Param2-------Param3------------000000000Param4
Reply Msg:Param1Param2Result1Param3Result2Result3Param4Resullt5

When I need to extract Result1,Result2.....Result5, I have parse the reply text message at character level.

Is there any better way that MQ Supports?

thank you
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Jun 01, 2011 11:41 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Why do you expect that your messaging transport will provide a means of parsing your business data?
Back to top
View user's profile Send private message
veda7
PostPosted: Wed Jun 01, 2011 11:49 am    Post subject: Reply with quote

Newbie

Joined: 01 Jun 2011
Posts: 4

mqjeff wrote:
Why do you expect that your messaging transport will provide a means of parsing your business data?


It would be nice sending message with setX() methods so that we can get required parts of the message through getX() methods. While processing such large messages.

Is it the usual way to handle such large reply messages with several loops, and string methods such as charAt(), indexOf(), subString()?

[Sorry I am new to MQ world]

Thank you
Back to top
View user's profile Send private message
Vitor
PostPosted: Wed Jun 01, 2011 11:59 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

veda7 wrote:
Is it the usual way to handle such large reply messages with several loops, and string methods such as charAt(), indexOf(), subString()?

[Sorry I am new to MQ world]


It's always the case that WMQ messages are blind to the business format of the data they carry. In a situation such as yours the sending & receiving applications have an agreed format: one example would be a fixed format like a COBOL copybook or a C header; another example is where the data items in the string are delimited by one or more special characters. This is no different to data being transferred by http or by file; the mechanism is blind to the content.

In the Java world, many applications (to quote a 3rd example) transmit the data as XML and bolt a parser into the application.

The key question here is what does the application receiving your message expect the format to be? If it expects a 5000 character string then sending the data as message properties isn't going to work for them.

(It's also somewhat anti-pattern - message properties tend to be exactly that, meta-data properties of the payload message)

Other views may be equally valid.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Jun 01, 2011 1:27 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

veda7 wrote:
mqjeff wrote:
Why do you expect that your messaging transport will provide a means of parsing your business data?


It would be nice sending message with setX() methods so that we can get required parts of the message through getX() methods. While processing such large messages.

Is it the usual way to handle such large reply messages with several loops, and string methods such as charAt(), indexOf(), subString()?

[Sorry I am new to MQ world]

Thank you


Have you looked at the javax.jms.StreamMessage at all?
It will not satisfy your structure length requirements but should allow you to write x objects and retrieve them in order....

However talking about interchangeability and multi-platform support, XML is the way to go...
_________________
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 » Trouble building large JMS TextMessage
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.