Author |
Message
|
cpeele |
Posted: Fri Apr 13, 2007 5:10 am Post subject: How to grab and display just the actual text of the message |
|
|
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 |
|
 |
jefflowrey |
Posted: Fri Apr 13, 2007 6:17 am Post subject: |
|
|
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 |
|
 |
cpeele |
Posted: Fri Apr 13, 2007 6:29 am Post subject: |
|
|
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 |
|
 |
fjb_saper |
Posted: Fri Apr 13, 2007 12:30 pm Post subject: |
|
|
 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 |
|
 |
Vitor |
Posted: Sat Apr 14, 2007 3:45 pm Post subject: |
|
|
 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 |
|
 |
|