Java tutorial
package org.panksdmz.jms.tibco; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.Queue; import javax.jms.QueueConnection; import javax.jms.QueueReceiver; import javax.jms.QueueSender; import javax.jms.QueueSession; import javax.jms.TextMessage; import org.springframework.jms.connection.CachingConnectionFactory; import com.siemens.soarian.se.dates.CaliHDateTime; /* * Copyright(c) 2013 Siemens Medical Solutions Health * Services Corporation. All rights reserved. This software is * confidential, proprietary to Siemens, is protected by * copyright laws in the U.S. and abroad, and is licensed for use * by customers only in strict accordance with the license * agreement governing its use. */ public class MessageRecieverBean { private CachingConnectionFactory connectionFactory; private String recieveQueueName; public CachingConnectionFactory getConnectionFactory() { return connectionFactory; } public void setConnectionFactory(CachingConnectionFactory connectionFactory) { this.connectionFactory = connectionFactory; } public String getRecieveQueueName() { return recieveQueueName; } public void setRecieveQueueName(String recieveQueueName) { this.recieveQueueName = recieveQueueName; } public void recieve() { try { QueueConnection connection = connectionFactory.createQueueConnection(); QueueSession session = connection.createQueueSession(false, javax.jms.Session.AUTO_ACKNOWLEDGE); Queue queue = session.createQueue(this.recieveQueueName); QueueReceiver receiver = session.createReceiver(queue); connection.start(); Message receive = receiver.receive(); System.out.println(receive); } catch (JMSException e) { e.printStackTrace(); } } }