I'm new to the IBM Websphere MQ server and have few issues when I work with this.
I'm using MQQueueConnectionFactory
to send a message to a queue. Here is my code.
MQQueueConnectionFactory connectionFactory = null;
QueueConnection queueConn = null;
QueueSession queueSession = null;
QueueSender queueSender = null;
TextMessage message = null;
try
{
connectionFactory = new MQQueueConnectionFactory();
connectionFactory.setHostName("192.16.34.45");
connectionFactory.setPort(1415);
connectionFactory.setTransportType(1);
connectionFactory.setQueueManager("MQSLLXQ1");
connectionFactory.setChannel("TO.MQSLLXQ1");
queueConn = connectionFactory.createQueueConnection("username", "password");
queueSession = queueConn.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
queueSender = queueSession.createSender(queueSession.createQueue("TestQueue"));
queueSender.setDeliveryMode(DeliveryMode.PERSISTENT);
message = queueSession.createTextMessage("Test Message");
queueSender.send(message);
queueConn.close();
} catch (Exception je) {
je.printStackTrace();
}
The message visible in the MQ queue with JMS header.
<mcd><Msd>jms_text</Msd></mcd>
<jms><Dst>queue:///TestQueue</Dst><Tms>1454047279356</Tms><Div>2</Div></jms>
Test Message
1) Is there a way to avoid this jms header and get only the payload in MQ Queue?
2) Is there a way to sync both MQ Queue and JMS Queue together?