Author |
Message
|
rogerjoelsson |
Posted: Mon Jun 23, 2008 4:10 am Post subject: Cannot get rid of JMS RFH2 header using IBM MQ |
|
|
Newbie
Joined: 23 Jun 2008 Posts: 3
|
Hi all,
I'm experiencing a problem using IBM MQ against a non-JMS client. The problem is that I cannot get rid of the JMS (RFH2) header in the message being sent to the external receiver!
After some research, I've learnt that the correct way to get rid of the header is to put a parameter into the session.createQueue(jmsProviderDestinationName) call.
I try to set the jmsProviderDestinationName to the following MQ URL:
queue:///MYQUEUE?targetClient=1
(Thus doing session.createQueue("queue:///MYQUEUE?targetClient=1"))
I've also tried specifying the Queue Manager, thus including it in the URL as follows:
queue://QMGR/MYQUEUE?targetClient=1
However, it does *not* work. I'm running out of ideas now, does anyone have any further ideas or hints?
*Any* hint that may get me further is greatly appreciated!
Regards,
Roger |
|
Back to top |
|
 |
sridhsri |
Posted: Mon Jun 23, 2008 6:45 am Post subject: works for me |
|
|
Master
Joined: 19 Jun 2008 Posts: 297
|
Roger,
I tried the same piece of code and it works for me. I am not sure why that didn't work for you. |
|
Back to top |
|
 |
rogerjoelsson |
Posted: Mon Jun 23, 2008 6:48 am Post subject: Re: works for me |
|
|
Newbie
Joined: 23 Jun 2008 Posts: 3
|
sridhsri wrote: |
Roger,
I tried the same piece of code and it works for me. I am not sure why that didn't work for you. |
Wonderful -- at last a success story! Do you have any code samples and/or snippets on how you did it? |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jun 23, 2008 7:25 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
What is the value for targetClientMatching on your QCF?
Can we see your code snippet?  _________________ MQ & Broker admin
Last edited by fjb_saper on Mon Jun 23, 2008 7:25 am; edited 1 time in total |
|
Back to top |
|
 |
manicminer |
Posted: Mon Jun 23, 2008 7:25 am Post subject: Re: works for me |
|
|
 Disciple
Joined: 11 Jul 2007 Posts: 177
|
rogerjoelsson wrote: |
sridhsri wrote: |
Roger,
I tried the same piece of code and it works for me. I am not sure why that didn't work for you. |
Wonderful -- at last a success story! Do you have any code samples and/or snippets on how you did it? |
Have you checked MQ version and CSD level? Have you checked on IBM's MQ sites that there are not any problems with the version you are using? Are you using the appropriate latest MQ jar files?
In particular there are known bad CSD's for MQ 5.3 to do with JMS. |
|
Back to top |
|
 |
sridhsri |
Posted: Mon Jun 23, 2008 4:33 pm Post subject: Code Snippet |
|
|
Master
Joined: 19 Jun 2008 Posts: 297
|
Roger,
The code I have was in fact copied from your question. I was wondering why it didn't work for you and gave it a shot. I tried it in two ways. I used the JMSAdmin on the MQ Explorerand created a JMS Queue and on that JMS queue, set the target application to MQ. That worked. After that, I tried it with this:
Queue queue = session.createQueue("queue://QMGR/IN?targetClient=1");
That was exactly what you had (except that IN is the websphere MQ queue and not the JMS queue. but i guess you already knew that).
I am using MQ 6.0.2.4 |
|
Back to top |
|
 |
sridhsri |
Posted: Mon Jun 23, 2008 4:35 pm Post subject: Code Snippet |
|
|
Master
Joined: 19 Jun 2008 Posts: 297
|
Properties prop = new Properties();
prop.setProperty(InitialContext.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.fscontext.RefFSContextFactory");
prop.setProperty(InitialContext.PROVIDER_URL,"file:/E:/JNDI-Directory");
InitialContext ctx = new InitialContext(prop);
QueueConnectionFactory factory = (QueueConnectionFactory)ctx.lookup("myQCF");
QueueConnection connection = factory.createQueueConnection();
QueueSession session = (QueueSession)connection.createQueueSession(false,Session.AUTO_ACKNOWLEDGE);
Queue queue = session.createQueue("queue://QMGR/IN?targetClient=1");
QueueSender sender = (QueueSender)session.createSender(queue);
//publisher.setDeliveryMode(JMSC.MQJMS_PER_PER);
TextMessage msg = session.createTextMessage(sMessage);
sender.send(msg);
session.close();
connection.stop();
connection.close(); |
|
Back to top |
|
 |
JavaRat |
Posted: Tue Jun 24, 2008 11:06 pm Post subject: |
|
|
Newbie
Joined: 23 Jun 2008 Posts: 8
|
Hello everyone,
This has been interesting reading so far, please forgive my ignorance but I have not got this to work properly either so far. I am able to put a message onto a websphere (version 6) queue looking something like this:
Message browsed with websphere MQ and rfhutil
Code: |
XQH ....MYQUEUE
[i]<sendingqueue>[/i]
MD ................ÿÿÿÿ.... .....,....MQSTR ...........AMQ Q01
n,WH / P .................................................................
Q01 [i]<myuserloginname>[/i] ....................ÃBo0,½.6F...r
............................................
.....WebSphere MQ Client for Java20080625 07552616 Testmessage
|
using the following code...
Code: |
try {
MQQueueConnectionFactory cf = new MQQueueConnectionFactory();
// Provide info to contact the MQ websphere (version 6) queue
cf.setHostName("100.100.100.100");
cf.setPort(1414);
cf.setTransportType(JMSC.MQJMS_TP_CLIENT_MQ_TCPIP);
cf.setQueueManager("Q01");
// Setup the Queue and try to remove the additional text in the
//message, appearing on the websphere MQ side
MQQueueConnection connection = (MQQueueConnection)cf.createQueueConnection();
MQQueueSession session = (MQQueueSession) connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
MQQueue queue = (MQQueue) session.createQueue("queue://Q01/MYQUEUE?targetClient=1");
MQQueueSender sender = (MQQueueSender) session.createSender(queue);
TextMessage message = (TextMessage) session.createTextMessage("Test message");
// Start the connection
connection.start();
//Send the testmessage
sender.send(message);
//Print the messageinfo going to MQ
System.out.println("Sent message:\\n" + message);
//Close connections
sender.close();
session.close();
connection.close();
//Print a notice
System.out.println("\\nSUCCESS\\n");
}
catch (JMSException jmsex) {
//Print exceptionproblems for debugging purposes
System.out.println(jmsex);
System.out.println("\\nFAILURE\\n");
}
catch (Exception ex) {
//Print exceptionproblems for debugging purposes
System.out.println(ex);
System.out.println("\\nFAILURE\\n");
}
}
|
What we want is to remove all the text and only see the "testmessage" when browsing it. How do we accomplish this?
If I remove ?targetClient=1 the only differnce to the message when I browse it is that these xmltags appear:
Code: |
XQH ....MYQUEUE
[i]<sendingqueue>[/i]
MD ................ÿÿÿÿ.... .....,....MQSTR ...........AMQ Q01
n,WH / P .................................................................
Q01 [i]<myuserloginname>[/i] ....................ÃBo0,½.6F...r
............................................
.....WebSphere MQ Client for Java20080625 07552616
<mcd><Msd>jms_text</Msd></mcd>...L<jms><Dst>queue://Q01/MYQUEUE</Dst><Tms>07552616</Tms><Dlv>2</Dlv></jms>Testmessage
|
Further, adding for instance
message.setStringProperty("JMS_IBM_Format", MQC.MQFMT_STRING);
or/and
queue.setTargetClient(JMSC.MQJMS_CLIENT_NONJMS_MQ);
to the code above changes nothing in the resulting messages when I browse it with MQwebsphere or rfhutil.
Also to my surprise in rfhutil I find the format type to be of MQXMIT ???
Any help or suggestions to what I am doing wrong here would be very appreciated.
/the JavaRat |
|
Back to top |
|
 |
rogerjoelsson |
Posted: Wed Jun 25, 2008 12:52 am Post subject: Problems remain :( |
|
|
Newbie
Joined: 23 Jun 2008 Posts: 3
|
Hi all,
To summarize, the core problems remain:
1. The RFH2 header is still present, though the code above is being used. Are there any other ways of initializing the queue that will fix the problem? Our system setup forces us to create the ConnectionFactory instance programmatically, hence not using JNDI. Is hope that does not present a problem?
2. The Message Format still remains MQXMIT, even though we send an MQ TextMessage. The expected (and preferred) Message Format i TEXT.
Anyone?
Regards,
Roger |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jun 25, 2008 5:59 am Post subject: Re: Problems remain :( |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
rogerjoelsson wrote: |
Hi all,
To summarize, the core problems remain:
1. The RFH2 header is still present, though the code above is being used. Are there any other ways of initializing the queue that will fix the problem? Our system setup forces us to create the ConnectionFactory instance programmatically, hence not using JNDI. Is hope that does not present a problem?
2. The Message Format still remains MQXMIT, even though we send an MQ TextMessage. The expected (and preferred) Message Format i TEXT.
Anyone?
Regards,
Roger |
So why are you looking at the message on the XMITQ instead of looking at the message on the destination queue?
The xmit header is a legitimate routing header added by the qmgr (when using a remote queue). It will be removed by the destination qmgr.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
JavaRat |
Posted: Thu Jun 26, 2008 5:43 am Post subject: |
|
|
Newbie
Joined: 23 Jun 2008 Posts: 8
|
You are correct fjb_saper!
Reading from the transmit queue is possible but not adviceable. It is not intended to be used for the purpose of viewing.
To view messages you should instead read from the destination queue (which should not contain this strange header).
Thank you everyone for your involvment and replies on this matter.
Well done!
Regards
/theJavaRat |
|
Back to top |
|
 |
manish kanaujia |
Posted: Wed Jun 22, 2011 5:02 am Post subject: Getting funny character in your MQ manager. |
|
|
Newbie
Joined: 22 Jun 2011 Posts: 1
|
All of this i have tried, but the final answer is to correct your binding file.
in our scenario binding file is created as, as u can see below, u just need to find out input queue and output queue
incorrect:(showing is zero (0))
RequestQueuename/RefAddr/5/Content=0
ResponseQueuename/RefAddr/5/Content=0
correct: replace 0 with 1
RequestQueuename/RefAddr/5/Content=1
ResponseQueuename/RefAddr/5/Content=1 |
|
Back to top |
|
 |
|