Author |
Message
|
sijtom0703 |
Posted: Mon Jan 21, 2013 8:35 am Post subject: Unable to see Messages in Websphere Explorer send from JMS |
|
|
 Voyager
Joined: 28 May 2011 Posts: 84 Location: USA
|
Hi ,
I am trying to send messages from a JMS Code running locally to a local Queue. I am able to send successfully but not able to see the messages in the local Queue in WebSphere MQ Explorer. Do I need to use JNDI and JMS Administered objects for this.
Quote: |
MQQueueConnectionFactory cf = new MQQueueConnectionFactory();
// Configuration values for Connection
cf.setHostName("Hostname");
cf.setPort(1414);
cf.setIntProperty(WMQConstants.WMQ_CONNECTION_MODE, WMQConstants.WMQ_CM_CLIENT);
cf.setQueueManager("TEST.JMS");
cf.setChannel("SYSTEM.DEF.SVRCONN");
MQQueueConnection connection = (MQQueueConnection) cf.createQueueConnection();
MQQueueSession session = (MQQueueSession) connection.createQueueSession(true, Session.CLIENT_ACKNOWLEDGE);
MQQueue queue = (MQQueue) session.createQueue("queue:///LQ");
MQQueueSender sender = (MQQueueSender) session.createSender(queue);
MQQueueReceiver receiver = (MQQueueReceiver) session.createReceiver(queue);
long uniqueNumber = System.currentTimeMillis() % 1000;
JMSTextMessage message = (JMSTextMessage) session.createTextMessage("MQJMSTest "+ uniqueNumber);
//MQMessage message = (MQMessage) session.createTextMessage("MQJMSTest "+ uniqueNumber);
// Start the connection
connection.start();
sender.send(message);
System.out.println("Sent message:\\n" + message);
|
|
|
Back to top |
|
 |
mqjeff |
Posted: Mon Jan 21, 2013 8:43 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You did not include any code that would prove that you did actually send the message correctly, nor even any code that would prove that you did actually connect or start the connection successfully. |
|
Back to top |
|
 |
sijtom0703 |
Posted: Mon Jan 21, 2013 9:29 am Post subject: |
|
|
 Voyager
Joined: 28 May 2011 Posts: 84 Location: USA
|
It is connecting though because I have a local queue LQ defined in the Queue Manager and if I delete that it is throwing
Quote: |
com.ibm.msg.client.jms.DetailedInvalidDestinationException: JMSWMQ2008: Failed to open MQ queue 'LQ'. JMS attempted to perform an MQOPEN, but WebSphere MQ reported an error. Use the linked exception to determine the cause of this error. Check that the specified queue and queue manager are defined correctly.
\nFAILURE\n |
|
|
Back to top |
|
 |
mqjeff |
Posted: Mon Jan 21, 2013 9:32 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
So what you're saying is that absolutely no exceptions were thrown by your code at all, even though you have included no code to catch and report them. |
|
Back to top |
|
 |
sijtom0703 |
Posted: Tue Jan 22, 2013 7:36 am Post subject: |
|
|
 Voyager
Joined: 28 May 2011 Posts: 84 Location: USA
|
Hi,
I was not doing a commit before closing a transacted session and hence not able to view the messages in Explorer
Code: |
// Start the connection
connection.start();
sender.send(message);
session.commit(); |
|
|
Back to top |
|
 |
|