Created
July 3, 2012 15:52
-
-
Save jdeoliveira/3040626 to your computer and use it in GitHub Desktop.
Sending JMS messages using ActiveMQ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.jms.*; | |
import org.apache.activemq.ActiveMQConnection; | |
import org.apache.activemq.ActiveMQConnectionFactory; | |
ConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616"); | |
Connection connection = connectionFactory.createConnection(); | |
connection.start(); | |
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); | |
Destination destination = session.createQueue("queue.rejectedRequests"); | |
MessageProducer producer = session.createProducer(destination); | |
TextMessage message = session.createTextMessage("${employeeId}"); | |
producer.send(message); | |
connection.close(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment