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 » How to grab and display just the actual text of the message

Post new topic  Reply to topic
 How to grab and display just the actual text of the message « View previous topic :: View next topic » 
Author Message
cpeele
PostPosted: Fri Apr 13, 2007 5:10 am    Post subject: How to grab and display just the actual text of the message Reply with quote

Acolyte

Joined: 04 Apr 2007
Posts: 53

Hey guys, I am using XMS.NET and have a C# pub/sub app that works just fine. The problem is just want to display the actual text message sent (i.e. "Hello world") and not all the header and messaage info along with it.

How would I go about doing that? I know XMS.NET is very similar to JMS so any help would be appreciated. Thanks!

In the following code:
---------------------------
Code:

//receive the message
Console.WriteLine("Waiting for message...");
IMessage recvMsg = subscriber.Receive(timeout);

//Display message
Console.WriteLine(recvMsg);


-----------------------------
recvMsg contains the message that was sent plus a bunch of header information.
How do I grab and display just the Text of the message and not the other stuff?

Thanks again!!!
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Apr 13, 2007 6:17 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

This is not a Java question.

You have to use methods on the IMessage object to get the pieces of information you want, instead of asking it to turn the entire message into a string.

That's the thing about objects - they have methods you can call to do different things.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
cpeele
PostPosted: Fri Apr 13, 2007 6:29 am    Post subject: Reply with quote

Acolyte

Joined: 04 Apr 2007
Posts: 53

I know there are other properties and methods of IMessage, but none do what I am asking.

I know this is a Java forum, but XMS is built from JMS and I didn't see a XMS forum.

I don't appreciate the sarcasm, so if you aren't going to help then don't post.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Apr 13, 2007 12:30 pm    Post subject: Reply with quote

Grand High Poobah

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

cpeele wrote:
I know there are other properties and methods of IMessage, but none do what I am asking.

I know this is a Java forum, but XMS is built from JMS and I didn't see a XMS forum.

I don't appreciate the sarcasm, so if you aren't going to help then don't post.
Don't get all irate and riled up...
Jeff's comment was right on the money.

In JMS it is msg.getText() (for a TextMessage) so I guess you should have a similar method on IMessage....

Remember if you want to suppress the RFH header you will have to use something like
Destination = "queue://MYQMGR/MYQUEUE?targetClient=1"

This is the destination in URI form.
You can always try to cast and set the targetClient property...

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Sat Apr 14, 2007 3:45 pm    Post subject: Reply with quote

Grand High Poobah

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

cpeele wrote:
I know this is a Java forum, but XMS is built from JMS and I didn't see a XMS forum.


XMS questions are normally posted in the API forum. It being an wrapper round the API. Rather than any kind of Java code.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » How to grab and display just the actual text of the message
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.