Example usage for javax.jms JMSException printStackTrace

List of usage examples for javax.jms JMSException printStackTrace

Introduction

In this page you can find the example usage for javax.jms JMSException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:biz.fstechnology.micro.common.jms.JmsServiceConnection.java

/**
 * @see biz.fstechnology.micro.common.DefaultServiceConnection#call(biz.fstechnology.micro.common.Request)
 *//*from  www  . j a  v a  2  s .  c  om*/
@Override
public <T, U> Result<U> call(Request<T> request) {
    try {
        return call(getDefaultDestination(), request);
    } catch (JMSException e) {
        e.printStackTrace();
        return new Result<>(e);
    }
}

From source file:probe.MyGlimpseProbe_SimMonLearnPAd.java

private void generateAndSendExample_GlimpseBaseEvents_StringPayload(String data, AbstractEvent event)
        throws UnknownHostException {
    DebugMessages.print(TimeStamp.getCurrentTime(), MyGlimpseProbe_SimMonLearnPAd.class.getName(),
            "Creating GlimpseBaseEvent_SimMonLearnPAd message");
    GlimpseBaseEventBPMN<String> message;
    DebugMessages.ok();//from w  ww.  ja  v a  2s.  c  o m
    DebugMessages.line();
    message = new GlimpseBaseEventBPMN<String>("eventForCP", "aProbe", System.currentTimeMillis(), data, false,
            "extraField", event);

    try {
        this.sendEventMessage(message, false);
    } catch (JMSException e) {
        e.printStackTrace();
    } catch (NamingException e) {
        e.printStackTrace();
    }
}

From source file:org.openbaton.common.vnfm_sdk.amqp.AbstractVnfmSpringJMS.java

@Override
public void onMessage(Message message) {
    NFVMessage msg = null;/*  ww  w .j  av  a 2s  .  c  o  m*/
    try {
        msg = (NFVMessage) ((ObjectMessage) message).getObject();
    } catch (JMSException e) {
        e.printStackTrace();
        System.exit(1);
    }
    log.trace("VNFM: received " + msg);
    try {
        this.onAction(msg);
    } catch (NotFoundException e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    } catch (BadFormatException e) {
        e.printStackTrace();
        throw new RuntimeException(e);
    }
}

From source file:Supplier.java

public void run() {
    ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(user, password, url);
    Session session = null;/*from   w  w w  . j av a2 s  .  com*/
    Destination orderQueue;
    try {
        Connection connection = connectionFactory.createConnection();

        session = connection.createSession(true, Session.SESSION_TRANSACTED);
        orderQueue = session.createQueue(QUEUE);
        MessageConsumer consumer = session.createConsumer(orderQueue);

        connection.start();

        while (true) {
            Message message = consumer.receive();
            MessageProducer producer = session.createProducer(message.getJMSReplyTo());
            MapMessage orderMessage;
            if (message instanceof MapMessage) {
                orderMessage = (MapMessage) message;
            } else {
                // End of Stream
                producer.send(session.createMessage());
                session.commit();
                producer.close();
                break;
            }

            int quantity = orderMessage.getInt("Quantity");
            System.out.println(
                    ITEM + " Supplier: Vendor ordered " + quantity + " " + orderMessage.getString("Item"));

            MapMessage outMessage = session.createMapMessage();
            outMessage.setInt("VendorOrderNumber", orderMessage.getInt("VendorOrderNumber"));
            outMessage.setString("Item", ITEM);

            quantity = Math.min(orderMessage.getInt("Quantity"),
                    new Random().nextInt(orderMessage.getInt("Quantity") * 10));
            outMessage.setInt("Quantity", quantity);

            producer.send(outMessage);
            System.out.println(ITEM + " Supplier: Sent " + quantity + " " + ITEM + "(s)");
            session.commit();
            System.out.println(ITEM + " Supplier: committed transaction");
            producer.close();
        }
        connection.close();
    } catch (JMSException e) {
        e.printStackTrace();
    }
}

From source file:edu.harvard.i2b2.crc.ejb.QueryLargeExecutorMDB.java

/**
 * Take the XML based message and delegate to 
 * the system coordinator to  handle the 
 * actual processing/* www .  j a  v  a2s.  co m*/
 * @param msg th JMS TextMessage 
 *             object containing XML data
 */
public void onMessage(Message msg) {
    MapMessage message = (MapMessage) msg;
    try {
        log.info("Executing from Large queue for query instance [ "
                + message.getString(QueryManagerBeanUtil.QUERY_INSTANCE_ID_PARAM) + " ]");
    } catch (JMSException e) {
        e.printStackTrace();
    }
    //call executor mdb class with this session context
    QueryExecutorMDB queryMdb = new QueryExecutorMDB(sessionContext, QueryExecutorMDB.LARGE_QUEUE);
    queryMdb.onMessage(msg);

}

From source file:edu.harvard.i2b2.crc.ejb.QueryMediumExecutorMDB.java

/**
 * Take the XML based message and delegate to 
 * the system coordinator to  handle the 
 * actual processing// w ww.ja  va  2 s .c o  m
 * @param msg th JMS TextMessage 
 *             object containing XML data
 */
public void onMessage(Message msg) {
    MapMessage message = (MapMessage) msg;
    try {
        log.info("Executing from Medium queue for query instance [ "
                + message.getString(QueryManagerBeanUtil.QUERY_INSTANCE_ID_PARAM) + " ]");
    } catch (JMSException e) {
        e.printStackTrace();
    }
    //call executor mdb class with this session context
    QueryExecutorMDB queryMdb = new QueryExecutorMDB(sessionContext, QueryExecutorMDB.MEDIUM_QUEUE);
    queryMdb.onMessage(message);

}

From source file:org.apache.cactus.spi.server.MessageDrivenBeanRedirector.java

/**
 * Receives a message from a JMS Queue and make it available to the
 * test case./*from   w  w w  . j  a  va2  s . c  o  m*/
 *
 * @param theMessage the JMS Message
 */
public void onMessage(Message theMessage) {
    // Mark beginning of test on server side
    LOGGER.debug("------------- Start MDB service");

    // Gather MDB implicit objects
    MessageDrivenBeanImplicitObjects implicitObjects = new MessageDrivenBeanImplicitObjects();
    implicitObjects.setMessage(theMessage);
    implicitObjects.setMessageDrivenBeanContext(this.context);

    // Call the controller to handle the message
    MessageDrivenBeanTestController controller = new MessageDrivenBeanTestController();

    try {
        controller.handleRequest(implicitObjects);
    } catch (JMSException e) {
        e.printStackTrace();
    }

}

From source file:com.oneops.controller.jms.InductorListenerTest.java

@Test
/** test the message impl */
public void testListening() throws JMSException {
    try {//from  ww  w  .  j  a v  a  2 s. co m
        listener.init();

        TextMessage message = mock(TextMessage.class);
        when(message.getText()).thenReturn("{messgetext:true}");
        when(message.getStringProperty("task_id")).thenReturn("corel-id");
        when(message.getStringProperty("task_result_code")).thenReturn("200");
        when(message.getStringProperty("type")).thenReturn("deploybom");
        when(message.getJMSCorrelationID()).thenReturn("jms|cor!rel!ation!id");

        listener.onMessage(message);
        listener.cleanup();
        listener.getConnectionStats();
    } catch (JMSException e) {
        System.out.println("CAUTH EXCEPTION " + e.getMessage());
        e.printStackTrace();
        throw e;
    }

}

From source file:org.apache.servicemix.audit.async.AbstractJmsExchangeListener.java

public void afterPropertiesSet() throws Exception {
    if (factory == null) {
        throw new IllegalStateException(
                "Unable to initialize JMS ExchangeListener -- no ConnectionFactory set");
    }//from  w  w w . j a  v a2 s . com
    container = new DefaultMessageListenerContainer();
    container.setConnectionFactory(factory);
    container.setDestinationName(getDestinationName());
    container.setMessageListener(new MessageListener() {

        @SuppressWarnings("unchecked")
        public void onMessage(Message message) {
            ObjectMessage om = (ObjectMessage) message;
            try {
                T object = (T) om.getObject();
                switch (Event.valueOf(om.getStringProperty(EVENT))) {
                case Sent:
                    onSent(object);
                case Accepted:
                    onAccepted(object);
                }
            } catch (JMSException e) {
                e.printStackTrace();
            }
        }

    });
    container.afterPropertiesSet();
    container.setConcurrentConsumers(10);
    container.start();

    jmsTemplate = new JmsTemplate(factory);
    jmsTemplate.setDefaultDestinationName(getDestinationName());
}

From source file:eu.learnpad.simulator.mon.MyGlimpseProbe_SimMonLearnPAd.java

private void generateAndSendExample_GlimpseBaseEvents_StringPayload(String data, AbstractEvent event)
        throws UnknownHostException {
    DebugMessages.print(TimeStamp.getCurrentTime(), MyGlimpseProbe_SimMonLearnPAd.class.getName(),
            "Creating GlimpseBaseEvent_SimMonLearnPAd message");
    GlimpseBaseEventBPMN<String> message;
    DebugMessages.ok();//from  w  ww .  j a  v a2 s  .  c  o m
    DebugMessages.line();
    message = new GlimpseBaseEventBPMN<String>("eventForCP", "aProbe", System.currentTimeMillis(), data, false,
            "extraField", event);

    try {
        this.sendEventMessage(message, false);
    } catch (JMSException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (NamingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}