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:org.nuxeo.ecm.core.jms.JMSEventListener.java

private static void sendEventToJMS(CoreEvent coreEvent) {
    OperationEvent event = OperationEventFactory.createEvent(coreEvent);
    if (event != null) {
        try {//ww  w  .j a v  a2s . com
            CoreEventPublisher.getInstance().publish(event, event.getId());
        } catch (JMSException e) {
            e.printStackTrace();
        }
    }
}

From source file:eu.learnpad.simulator.mon.manager.ResponseDispatcher.java

public static void sendResponse(ComplexEventResponse response, String enablerName, String answerTopic) {
    try {/*from www  .  ja v  a  2 s.  c  o  m*/
        publicSession = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
        connectionTopic = publishSession.createTopic(answerTopic);
        tPub = publishSession.createPublisher(connectionTopic);

        ObjectMessage sendMessage = publishSession.createObjectMessage();
        sendMessage.setObject((Serializable) response);
        sendMessage.setStringProperty("DESTINATION", enablerName);
        tPub.publish(sendMessage);
    } catch (JMSException e) {
        e.printStackTrace();
    }
}

From source file:eu.learnpad.simulator.mon.manager.ResponseDispatcher.java

public static void sendResponse(ComplexEventException exception, String enablerName, String answerTopic) {
    try {//from   w  w  w . j  ava2 s .co  m
        publicSession = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
        connectionTopic = publishSession.createTopic(answerTopic);
        tPub = publishSession.createPublisher(connectionTopic);

        ObjectMessage sendMessage = publishSession.createObjectMessage();
        sendMessage.setObject((Serializable) exception);
        sendMessage.setStringProperty("DESTINATION", enablerName);
        tPub.publish(sendMessage);
    } catch (JMSException e) {
        e.printStackTrace();
    }
}

From source file:eu.learnpad.simulator.mon.manager.ResponseDispatcher.java

public static void sendResponse(Object object, String enablerName, String answerTopic) {
    try {// w ww. j a va2  s  .com
        publicSession = connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
        connectionTopic = publishSession.createTopic(answerTopic);
        tPub = publishSession.createPublisher(connectionTopic);

        ObjectMessage sendMessage = publishSession.createObjectMessage();
        sendMessage.setObject((Serializable) object);
        sendMessage.setStringProperty("DESTINATION", enablerName);
        tPub.publish(sendMessage);
    } catch (JMSException e) {
        e.printStackTrace();
    }
}

From source file:org.fao.geonet.jms.ClusterConfig.java

/**
 * Closes all Producers and Consumers.//from  w  w w .  ja v a 2 s. c o m
 *
 * @throws ClusterException hmm
 */
public static void shutdown() throws ClusterException {
    for (JMSActor participant : jmsActors) {
        // Capture exceptions to continue closing the rest of JMSActors.
        // Exceptions are logged in JMSActor.shutdown
        try {
            participant.shutdown();
        } catch (ClusterException ex) {

        }

    }

    // Close session and connection
    try {
        if (session != null)
            session.close();
        if (connection != null)
            connection.close();

    } catch (JMSException x) {
        Log.error(Geonet.JMS, x.getMessage());
        x.printStackTrace();
        throw new ClusterException(x.getMessage(), x);
    }
}

From source file:org.fao.geonet.jms.ClusterConfig.java

private static void initJMSConnection() throws ClusterException {
    try {//ww w  . jav a  2s. c o m
        // Getting JMS connection from the server
        System.out.println("Getting JMS Connection");
        ConnectionFactory connectionFactory = new ActiveMQConnectionFactory(ClusterConfig.getBrokerURL());
        connection = connectionFactory.createConnection();
        connection.setClientID(ClusterConfig.getClientID());
        connection.start();

        // Creating session for sending and receiving messages
        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

        // Set connection and session for all JMSActors
        JMSActor.connection = connection;
        JMSActor.session = session;
        System.out.println("Getiing JMS Connection successfull");
    } catch (JMSException x) {
        System.out.println("Getiing JMS Connection failed");
        System.err.println(x.getMessage());
        x.printStackTrace();
        throw new ClusterException(x.getMessage(), x);
    }
}

From source file:be.anova.courses.activemq.Application.java

public void onMessage(Message message) {
    if (message instanceof TextMessage) {
        try {//from   www.j  a v  a2  s.  c  om
            String text = ((TextMessage) message).getText();
            if (text.contains("quit")) {
                System.exit(0);
            }
        } catch (JMSException e) {
            e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
        }
    }
}

From source file:com.vnet.demo.config.NoteMessageListener.java

@Override
public void receive(Message message) {
    MapMessage mapMessage = (MapMessage) message;
    try {/*from  www  .  j  av a  2  s. co m*/
        Long id = mapMessage.getLong("ID");
        String opr = mapMessage.getString("OPR");

        noteService.syncNoteToIndex(id, opr);
    } catch (JMSException e) {
        e.printStackTrace();
    }
}

From source file:samples.jms.LoggingMessageListener.java

public void onMessage(Message message) {
    if (message instanceof TextMessage) {
        try {/*from w  w  w .j a  v a  2  s .c om*/
            String text = ((TextMessage) message).getText();
            log.info("Received: " + text);
        } catch (JMSException e) {
            e.printStackTrace();
        }
    }
}

From source file:ubic.gemma.core.job.executor.worker.TaskSubmissionListener.java

@Override
public void onMessage(Message message) {
    log.info("Received new remote task command!");

    ObjectMessage objectMessage = (ObjectMessage) message;
    TaskCommand taskCommand = null;/* w  ww  .  ja va2  s  .co m*/
    try {
        taskCommand = (TaskCommand) objectMessage.getObject();
    } catch (JMSException e) {
        e.printStackTrace();
    }
    log.info("Submitting task command for execution.");

    remoteTaskRunningService.submit(taskCommand);
}