Example usage for javax.jms JMSException getMessage

List of usage examples for javax.jms JMSException getMessage

Introduction

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

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.apache.stratos.messaging.message.receiver.health.stat.HealthStatEventMessageListener.java

@Override
public void onMessage(Message message) {
    if (message instanceof TextMessage) {
        TextMessage receivedMessage = (TextMessage) message;
        try {/*from ww  w  .  j  a  v  a2  s  .  c om*/
            if (log.isDebugEnabled()) {
                log.debug(String.format("Tenant message received: %s", ((TextMessage) message).getText()));
            }
            // Add received message to the queue
            messageQueue.add(receivedMessage);

        } catch (JMSException e) {
            log.error(e.getMessage(), e);
        }
    }
}

From source file:org.yestech.notify.service.JmsQueueNotificationConsumer.java

public void onMessage(Message message) {
    if (message instanceof ObjectMessage) {
        ObjectMessage objMessage = (ObjectMessage) message;
        INotificationJob job = null;// w  w  w.  j a  v  a  2s. co  m
        try {
            job = (INotificationJob) objMessage.getObject();
            recieve(job);
        } catch (JMSException e) {
            logger.error(e.getMessage(), e);
        }
    }
}

From source file:org.apache.stratos.messaging.message.receiver.instance.notifier.InstanceNotifierEventMessageListener.java

@Override
public void onMessage(Message message) {
    if (message instanceof TextMessage) {
        TextMessage receivedMessage = (TextMessage) message;
        try {/*from ww w.  ja va2 s.co  m*/
            if (log.isDebugEnabled()) {
                log.debug(String.format("Instance notifier message received: %s",
                        ((TextMessage) message).getText()));
            }
            // Add received message to the queue
            messageQueue.add(receivedMessage);

        } catch (JMSException e) {
            log.error(e.getMessage(), e);
        }
    }
}

From source file:net.homecredit.book.jms.JmsMessageListener.java

/**
 * Implementation of <code>MessageListener</code>.
 *///from w ww .  j  a va2 s .c o  m
public void onMessage(Message message) {
    try {
        int messageCount = message.getIntProperty(JmsMessageProducer.MESSAGE_COUNT);

        if (message instanceof TextMessage) {
            TextMessage tm = (TextMessage) message;
            String msg = tm.getText();

            logger.info("Processed message '{}'.  value={}", msg, messageCount);

            counter.incrementAndGet();
        }
    } catch (JMSException e) {
        logger.error(e.getMessage(), e);
    }
}

From source file:org.osgp.adapter.protocol.dlms.infra.messaging.DeviceRequestMessageListener.java

@Override
public void onMessage(final Message message) {
    try {//w  w w  .  j  a v a2 s  . c  om
        LOGGER.info("Received message of type: {}", message.getJMSType());

        final ObjectMessage objectMessage = (ObjectMessage) message;

        final MessageProcessor processor = this.dlmsRequestMessageProcessorMap
                .getMessageProcessor(objectMessage);

        processor.processMessage(objectMessage);

    } catch (final JMSException ex) {
        LOGGER.error("Exception: {} ", ex.getMessage(), ex);
    }
}

From source file:org.hoteia.qalingo.core.jms.cacheflush.listener.CacheFlushQueueListener.java

/**
 * Implementation of <code>MessageListener</code>.
 *///from   ww w  .  j a  va2  s . c om
public void onMessage(Message message) {
    try {
        if (message instanceof TextMessage) {
            TextMessage tm = (TextMessage) message;
            String valueJMSMessage = tm.getText();

            if (StringUtils.isNotEmpty(valueJMSMessage)) {
                final CacheFlushMessageJms cacheFlushMessageJms = xmlMapper.getXmlMapper()
                        .readValue(valueJMSMessage, CacheFlushMessageJms.class);

                cacheService.flushCacheEntity(cacheFlushMessageJms.getObjectClass(),
                        cacheFlushMessageJms.getObjectId().toString());

                if (logger.isDebugEnabled()) {
                    logger.debug("Processed message, value: " + valueJMSMessage);
                }
            } else {
                logger.warn("Cache Flush: Jms Message is empty");
            }
        }
    } catch (JMSException e) {
        logger.error(e.getMessage(), e);
    } catch (IOException e) {
        logger.error(e.getMessage(), e);
    }
}

From source file:org.hoteia.qalingo.core.jms.syncserveur.listener.SyncServeurStatusQueueListener.java

/**
 * Implementation of <code>MessageListener</code>.
 *//*from   www.  j  a  va 2 s . c o  m*/
public void onMessage(Message message) {
    try {
        if (message instanceof TextMessage) {
            TextMessage tm = (TextMessage) message;
            String valueJMSMessage = tm.getText();

            if (StringUtils.isNotEmpty(valueJMSMessage)) {
                final SyncServeurMessageJms syncServeurMessageJms = xmlMapper.getXmlMapper()
                        .readValue(valueJMSMessage, SyncServeurMessageJms.class);

                ServerStatus serverStatus = new ServerStatus();
                serverStatus.setLastCheckReceived(new Date());
                serverStatus.setServerName(syncServeurMessageJms.getServerName());
                serverStatus.setServerIp(syncServeurMessageJms.getServerIp());

                serverService.saveOrUpdateServerStatus(serverStatus, valueJMSMessage);

                if (logger.isDebugEnabled()) {
                    logger.debug("Processed message, value: " + valueJMSMessage);
                }
            } else {
                logger.warn("SyncServeur Jms Message is empty");
            }
        }
    } catch (JMSException e) {
        logger.error(e.getMessage(), e);
    } catch (IOException e) {
        logger.error(e.getMessage(), e);
    }
}

From source file:ubic.gemma.job.executor.worker.TaskControlListener.java

@Override
public void onMessage(Message message) {
    ObjectMessage objectMessage = (ObjectMessage) message;
    try {//from   w  w  w.ja v  a  2 s. c om
        TaskControl taskControl = (TaskControl) objectMessage.getObject();
        String taskId = taskControl.getTaskId();
        assert taskId != null;

        SubmittedTaskRemote submittedTask = remoteTaskRunningService.getSubmittedTask(taskControl.getTaskId());
        if (submittedTask == null) {
            log.warn("Got control request for taskId:" + taskId + ", but no submitted task found.");
            return;
        }

        switch (taskControl.getRequest()) {
        case CANCEL:
            log.info("Received CANCEL control message for task: " + taskControl.getTaskId());
            submittedTask.requestCancellation();
            break;
        case ADD_EMAIL_NOTIFICATION:
            log.info("Received ADD_EMAIL_NOTIFICATION control message for task: " + taskControl.getTaskId());
            submittedTask.addEmailAlertNotificationAfterCompletion();
            break;
        }

    } catch (JMSException e) {
        log.warn("Got JMSException: " + e.getMessage());
    }
}

From source file:com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.SigningServerResponsesMessageListener.java

@Override
public void onMessage(final Message message) {
    try {/*from  www .ja  v a 2s  . c om*/
        LOGGER.info("Received message of type: {}", message.getJMSType());

        final ObjectMessage objectMessage = (ObjectMessage) message;
        final String messageType = objectMessage.getJMSType();
        final String correlationId = objectMessage.getJMSCorrelationID();
        final String deviceIdentification = objectMessage.getStringProperty(Constants.DEVICE_IDENTIFICATION);
        final ResponseMessage responseMessage = (ResponseMessage) objectMessage.getObject();
        final ResponseMessageResultType result = responseMessage == null ? null : responseMessage.getResult();

        // Check the result.
        if (result.equals(ResponseMessageResultType.NOT_OK)) {
            LOGGER.error("OslpEnvelope was not signed by signing-server. Unable to send request to device: {}",
                    deviceIdentification);
            this.oslpSigningService.handleError(deviceIdentification, responseMessage);
            return;
        }

        LOGGER.info("messageType: {}, deviceIdentification: {}, result: {}, correlationId: {}", messageType,
                deviceIdentification, result, correlationId);

        // Get the DTO object containing signed OslpEnvelope.
        final SignedOslpEnvelopeDto signedOslpEnvelopeDto = (SignedOslpEnvelopeDto) responseMessage
                .getDataObject();

        this.oslpSigningService.handleSignedOslpEnvelope(signedOslpEnvelopeDto, deviceIdentification);
    } catch (final JMSException ex) {
        LOGGER.error("Exception: {} ", ex.getMessage(), ex);
    }
}

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

@Override
public void onMessage(Message message) {
    ObjectMessage objectMessage = (ObjectMessage) message;
    try {/* w ww  .j a  v  a  2  s  .co m*/
        TaskControl taskControl = (TaskControl) objectMessage.getObject();
        String taskId = taskControl.getTaskId();
        assert taskId != null;

        SubmittedTaskRemote submittedTask = remoteTaskRunningService.getSubmittedTask(taskControl.getTaskId());
        if (submittedTask == null) {
            log.warn("Got control request for taskId:" + taskId + ", but no submitted task found.");
            return;
        }

        switch (taskControl.getRequest()) {
        case CANCEL:
            log.info("Received CANCEL control message for task: " + taskControl.getTaskId());
            submittedTask.requestCancellation();
            break;
        case ADD_EMAIL_NOTIFICATION:
            log.info("Received ADD_EMAIL_NOTIFICATION control message for task: " + taskControl.getTaskId());
            submittedTask.addEmailAlertNotificationAfterCompletion();
            break;
        default:
            log.info("Unknown request: " + taskControl.getRequest() + ", no action taken");
            break;
        }

    } catch (JMSException e) {
        log.warn("Got JMSException: " + e.getMessage());
    }
}