List of usage examples for javax.jms JMSException printStackTrace
public void printStackTrace()
From source file:org.mot.common.mq.ActiveMQFactory.java
/** * Method for closing the session ... make sure to call each time a session is opened * // ww w.j av a 2 s. c o m * @param session */ private void closeSession(Session session) { try { session.close(); } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:org.jengine.mbean.FTPHL7Client.java
private void initializeQueueConnection() { try {//from w w w .jav a 2 s . co m if (session != null) session.close(); ctx = getInitialContext(); factory = (QueueConnectionFactory) ctx.lookup(CONNECTION_FACTORY); connection = factory.createQueueConnection(); session = connection.createQueueSession(false, Session.CLIENT_ACKNOWLEDGE); StringTokenizer st = new StringTokenizer(QueueNames, ":"); while (st.hasMoreElements()) { queue = (Queue) ctx.lookup("queue/" + st.nextElement()); Queues.add(queue); qSender = session.createSender(queue); QSenders.add(qSender); } } catch (JMSException je) { je.printStackTrace(); } catch (NamingException ne) { ne.printStackTrace(); } }
From source file:org.mot.common.mq.ActiveMQFactory.java
public void closeMessageProducer(MessageProducer mp) { try {//from w w w . j a v a2s . c o m mp.close(); } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:org.mot.common.mq.ActiveMQFactory.java
/** * Use this method to create a message consumer object. * /* w ww. java 2s.c o m*/ * @param source - provide a source as destination object * @param messageProcessor - provide a message listener interface for the message processing */ public void createMessageConsumer(Destination source, MessageListener messageProcessor) { try { MessageConsumer msg = session.createConsumer(source); msg.setMessageListener(messageProcessor); } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:org.mot.common.mq.ActiveMQFactory.java
/** * Use this method to create a new destination by name * //from w ww .j a v a 2 s. c om * @param name - Name of the destination queue * @return - Destination object */ public Destination createDestination(String name) { Destination dest = null; try { dest = session.createQueue(name); } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); } return dest; }
From source file:org.mot.common.mq.ActiveMQFactory.java
/** * Use this method to create a message consumer object. * //from ww w . ja v a 2 s. c o m * @param source - provide a source as destination object * @param messageProcessor - provide a message listener interface for the message processing * @param symbol - provide the symbol */ public void createMessageConsumer(final Destination source, final MessageListener messageProcessor, final String symbol) { try { MessageConsumer msg = session.createConsumer(source, "Symbol = '" + symbol + "'"); msg.setMessageListener(messageProcessor); } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:org.mot.common.mq.ActiveMQFactory.java
/** * @param source/* w ww. j a v a2 s. c o m*/ * @param messageProcessor * @param symbol * @param currency */ public void createMessageConsumer(final Destination source, final MessageListener messageProcessor, final String symbol, final String currency) { try { MessageConsumer msg = session.createConsumer(source, "Symbol = '" + symbol + "' AND Currency ='" + currency + "'"); msg.setMessageListener(messageProcessor); } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:org.mot.common.mq.ActiveMQFactory.java
/** * Publish a tick history object//from w w w. j ava 2s . co m * @param tick */ public void publishTickHistory(TickHistory tick, MessageProducer mp) { BytesMessage tickMessage; try { Session session = this.createSession(); // Create a new ByteMessage tickMessage = session.createBytesMessage(); // Serialize the tick content into the message tickMessage.writeBytes(tick.serialize()); mp.send(tickMessage); this.closeSession(session); } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:org.mot.common.mq.ActiveMQFactory.java
/** * @param order - Order to be placed//from w w w . j a v a 2 s. c o m * @param ttl - Time to live. Set to 0 for indefinite * @param deliveryMode - Set to 1 for non-persistent. Default 0 */ public void publishOrder(Order order, MessageProducer mp) { BytesMessage orderMessage; try { Session session = this.createSession(); // Create a new ByteMessage orderMessage = session.createBytesMessage(); // Serialize the tick content into the message orderMessage.writeBytes(order.serialize()); orderMessage.setStringProperty("Symbol", order.getSymbol()); mp.send(orderMessage); this.closeSession(session); } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:org.mot.common.mq.ActiveMQFactory.java
/** * Create a new message producer onto a particular destination * //from www . j a va 2 s. c o m * @param destination - destination queue/topic object * @return the message producer object */ public MessageProducer createMessageProducer(String channel, long ttl, boolean persistent) { Destination destination = createDestination(channel); MessageProducer msg = null; try { msg = session.createProducer(destination); msg.setTimeToLive(ttl); if (persistent) { msg.setDeliveryMode(DeliveryMode.PERSISTENT); } else { msg.setDeliveryMode(DeliveryMode.NON_PERSISTENT); } } catch (JMSException e) { // TODO Auto-generated catch block e.printStackTrace(); } return msg; }