Sending Messages to Remote JMS Server

The below code will send Message to a Remotely Located JMS Server. package com.codefloor; import java.util.Properties; import javax.jms.ObjectMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.jms.JMSException; import javax.jms.Session; import javax.jms.QueueSession; import javax.jms.QueueSender; import javax.jms.QueueConnection; import javax.jms.QueueConnectionFactory; import javax.jms.Queue; import javax.jms.DeliveryMode; import javax.naming.Context; import javax.naming.InitialContext; import javax.jms.TextMessage; public class MessageSender { private Queue _queue = null; private QueueConnection…

Details

Reading JMS Messages from Remote JMS Server

Below Java code will add a listener to the remote JMS Queue. package com.codefloor; import java.util.HashMap; import java.util.Properties; import javax.jms.TextMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.sql.Connection; import javax.jms.JMSException; import javax.jms.MessageListener; import javax.jms.QueueReceiver; import javax.jms.Session; import javax.jms.QueueSession; import javax.jms.QueueConnection; import javax.jms.QueueConnectionFactory; import javax.jms.Queue; import javax.servlet.http.HttpServlet; import javax.naming.Context; import javax.naming.InitialContext; public class QueueListner extends HttpServlet implements MessageListener…

Details