Author |
Message
|
ioat |
Posted: Wed Oct 08, 2008 10:05 pm Post subject: Could I send a JMS BytesMessage using C API? |
|
|
Acolyte
Joined: 18 Jul 2005 Posts: 53
|
I need to using C API to send a JMS BytesMessage, is it possible? |
|
Back to top |
|
 |
David.Partridge |
Posted: Thu Oct 09, 2008 2:26 am Post subject: |
|
|
 Master
Joined: 28 Jun 2001 Posts: 249
|
So long as you don't need an RFH2 with JMS properties, just set the message format in the MQMD to MQFMT_NONE.
Most JMS applications are tolerant of messages without RFH2. _________________ Cheers,
David C. Partridge |
|
Back to top |
|
 |
ioat |
Posted: Thu Oct 09, 2008 6:14 pm Post subject: |
|
|
Acolyte
Joined: 18 Jul 2005 Posts: 53
|
It works well, thanks a lot. |
|
Back to top |
|
 |
ioat |
Posted: Thu Oct 09, 2008 6:21 pm Post subject: |
|
|
Acolyte
Joined: 18 Jul 2005 Posts: 53
|
If I want to receive the JMS message (like TextMessage, BytesMessage and MapMessage) from C, is the only way to parse the received string myself?
eg: for MapMessage, I'll receive a xml string from C, then parse the xml myself.
Is there any other better way? |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Oct 09, 2008 6:28 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
ioat wrote: |
If I want to receive the JMS message (like TextMessage, BytesMessage and MapMessage) from C, is the only way to parse the received string myself?
eg: for MapMessage, I'll receive a xml string from C, then parse the xml myself.
Is there any other better way? |
Read up in the using Java manual where the mapping of base MQ to JMS MQ is described.
To get a TextMessage just set the format to MQFMT_STRING.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
ioat |
Posted: Thu Oct 09, 2008 6:40 pm Post subject: |
|
|
Acolyte
Joined: 18 Jul 2005 Posts: 53
|
I use the JMS to send the TextMessage, but received below from C:
RFH ? 3MQSTR ¸ <mcd><Msd>jms_text</Msd></mcd> L<jms><Dst>queue:///PTEST.Q1</Dst><Tms>1223452199596</Tms><Dlv>2</Dlv></jms> test TextMessage |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Oct 09, 2008 7:00 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
ioat wrote: |
I use the JMS to send the TextMessage, but received below from C:
RFH ? 3MQSTR ¸ <mcd><Msd>jms_text</Msd></mcd> L<jms><Dst>queue:///PTEST.Q1</Dst><Tms>1223452199596</Tms><Dlv>2</Dlv></jms> test TextMessage |
What you have is an RFH header. Set your JNDI to target client MQ or your uri as "queue://QMGR/QUEUE?targetClient=1". This will suppress the RFH header.
Note: you could also use the XMS support pack which gives you a JMS like interface in non java languages.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
ioat |
Posted: Thu Oct 09, 2008 7:04 pm Post subject: |
|
|
Acolyte
Joined: 18 Jul 2005 Posts: 53
|
I couldn't change the target client option. I want to code a MQ utility tool using C, to browse/receive the message from queue.
But the queue maybe only used for Java application, don't need to change the target client option.
Not formiliar with XMS, could it receive the JMS message directly?
The bad way is to parse the received message myself. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Oct 11, 2008 6:49 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
XMS will behave like JMS for you. Read up on the support pack documentation. Search the support pack with message service.  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|