Author |
Message
|
nelson |
Posted: Tue Oct 13, 2015 6:03 am Post subject: Setting MQMD.Format from a JMS API |
|
|
 Partisan
Joined: 02 Oct 2012 Posts: 313
|
Hi all,
We want to set the MQMD.Format from a java application running on WAS 8.5.5 using native JMS libraries and the Connection Factory and MQ resources managed by WAS:
Code: |
TextMessage message = session.createTextMessage(xml);
...
message.setStringProperty("JMS_IBM_Format", "MQFMT_STRING");
...
|
The documentation says you need to set JMS_IBM_Format property to MQFMT_STRING, that internally will be mapped against the MQMD.Format field.
In WAS, in the queue configuration, the format property body is "MQ" and the reply is "MQMD".
We have made a lot of tests and combinations of these properties, but no success... In MQ, the format is always set as blank...
Have any of you a clue on how to set the format?
Any help is very appreciated.
Thanks in advance. |
|
Back to top |
|
 |
zpat |
Posted: Tue Oct 13, 2015 6:20 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Options to generate standard MQSTR messages from JMS application.
1. Set the output MQ queue name URI (sometimes called destination resource) like this (rather than having just the queue name) - don't code the brackets []
queue:///[THE.MQ.QUEUE.DEFINITION]?targetClient=1
-------------------------- or ---------------------------
2. In the program code - set the target client on the queue object to NON JMS.
q.setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ);
------------------- or ---------------
3. In the JNDI or properties - do the same as option 2 - I don’t know much about how to do this.
NB: MQJMS_CLIENT_NONJMS_MQ equates to the value 1
--------------------------------------
I would suggest option 2. _________________ Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error. |
|
Back to top |
|
 |
nelson |
Posted: Tue Oct 13, 2015 7:34 am Post subject: |
|
|
 Partisan
Joined: 02 Oct 2012 Posts: 313
|
Thank you zpat for your reply.
For the second option, the setTargetClient method can only be used with com.ibm.mq.jms.MQQueue object... but.. we are not using at all com.ibm.mq.jms library... any workaround? |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Oct 13, 2015 7:59 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
So you are using JMS with probably a WAS type JNDI.
2 things are needed to achieve what you want to do.
- Define the message as a javax.jms.TextMessage i.e. use
Session.createTextMessage()
- Set the queue to use targetClient MQ.
You can either define that in the JNDI when you set up the queue
Or if using reading queue names from properties make sure you use the URI form:
String qname="queue:///QUEUENAME?targetClient=1";
Session.createQueue(qname);
If you are using pub/sub I would suggest that the application uses TextMessage and the receiving application codes for "properties in Handle" in order to not get an RFH2 header...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
nelson |
Posted: Tue Oct 13, 2015 11:34 am Post subject: |
|
|
 Partisan
Joined: 02 Oct 2012 Posts: 313
|
fjb_saper wrote: |
You can either define that in the JNDI when you set up the queue
|
How? we have tested a lot of combinations in the WAS configuration...
Thanks a lot for your help! |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Oct 13, 2015 11:52 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
put the target client property in the url in the jndi. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Oct 13, 2015 3:23 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
nelson wrote: |
fjb_saper wrote: |
You can either define that in the JNDI when you set up the queue
|
How? we have tested a lot of combinations in the WAS configuration...
Thanks a lot for your help! |
Did you switch the destination from type JMS to type MQ? And verify that it took in the config file after save? Obviously you'll have to bounce the server for the new config to take effect...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
nelson |
Posted: Thu Oct 15, 2015 4:12 am Post subject: |
|
|
 Partisan
Joined: 02 Oct 2012 Posts: 313
|
fjb_saper wrote: |
nelson wrote: |
fjb_saper wrote: |
You can either define that in the JNDI when you set up the queue
|
How? we have tested a lot of combinations in the WAS configuration...
Thanks a lot for your help! |
Did you switch the destination from type JMS to type MQ? And verify that it took in the config file after save? Obviously you'll have to bounce the server for the new config to take effect...  |
That was the trick, thanks a lot! |
|
Back to top |
|
 |
|