Search in sources :

Example 1 with MessageProcessor

use of org.opensmartgridplatform.shared.infra.jms.MessageProcessor in project open-smart-grid-platform by OSGP.

the class OsgpCoreRequestMessageListener method onMessage.

@Override
public void onMessage(final Message message) {
    try {
        LOGGER.info("Received message");
        final ObjectMessage objectMessage = (ObjectMessage) message;
        final MessageProcessor processor = this.messageProcessorMap.getMessageProcessor(objectMessage);
        processor.processMessage(objectMessage);
    } catch (final JMSException e) {
        // Can't read message.
        LOGGER.error("Exception: {}, StackTrace: {}", e.getMessage(), e.getStackTrace(), e);
    }
}
Also used : ObjectMessage(javax.jms.ObjectMessage) MessageProcessor(org.opensmartgridplatform.shared.infra.jms.MessageProcessor) JMSException(javax.jms.JMSException)

Example 2 with MessageProcessor

use of org.opensmartgridplatform.shared.infra.jms.MessageProcessor in project open-smart-grid-platform by OSGP.

the class OsgpCoreResponseMessageListener method onMessage.

@Override
public void onMessage(final Message message) {
    try {
        LOGGER.info("Received message of type: {}", message.getJMSType());
        final ObjectMessage objectMessage = (ObjectMessage) message;
        final MessageProcessor processor = this.messageProcessorMap.getMessageProcessor(objectMessage);
        processor.processMessage(objectMessage);
    } catch (final JMSException ex) {
        LOGGER.error("Exception: {} ", ex.getMessage(), ex);
    }
}
Also used : ObjectMessage(javax.jms.ObjectMessage) MessageProcessor(org.opensmartgridplatform.shared.infra.jms.MessageProcessor) JMSException(javax.jms.JMSException)

Example 3 with MessageProcessor

use of org.opensmartgridplatform.shared.infra.jms.MessageProcessor in project open-smart-grid-platform by OSGP.

the class KafkaRequestMessageListener method onMessage.

@Override
public void onMessage(final Message message) {
    try {
        LOGGER.info("Received message of type: {}", message.getJMSType());
        final ObjectMessage objectMessage = (ObjectMessage) message;
        final MessageProcessor processor = this.messageProcessorMap.getMessageProcessor(objectMessage);
        processor.processMessage(objectMessage);
    } catch (final JMSException ex) {
        LOGGER.error("Exception: {} ", ex.getMessage(), ex);
    }
}
Also used : ObjectMessage(javax.jms.ObjectMessage) MessageProcessor(org.opensmartgridplatform.shared.infra.jms.MessageProcessor) JMSException(javax.jms.JMSException)

Example 4 with MessageProcessor

use of org.opensmartgridplatform.shared.infra.jms.MessageProcessor in project open-smart-grid-platform by OSGP.

the class WebServiceRequestMessageListener method onMessage.

@Override
public void onMessage(final Message message) {
    try {
        LOGGER.info("Received message of type: {}", message.getJMSType());
        final ObjectMessage objectMessage = (ObjectMessage) message;
        final MessageProcessor processor = this.messageProcessorMap.getMessageProcessor(objectMessage);
        processor.processMessage(objectMessage);
    } catch (final JMSException ex) {
        LOGGER.error("Exception: {} ", ex.getMessage(), ex);
    }
}
Also used : ObjectMessage(javax.jms.ObjectMessage) MessageProcessor(org.opensmartgridplatform.shared.infra.jms.MessageProcessor) JMSException(javax.jms.JMSException)

Example 5 with MessageProcessor

use of org.opensmartgridplatform.shared.infra.jms.MessageProcessor in project open-smart-grid-platform by OSGP.

the class PublicLightingResponseMessageListener method onMessage.

@Override
public void onMessage(final Message message) {
    try {
        final String messageType = message.getJMSType();
        LOGGER.info("Received message of type: {}", messageType);
        final ObjectMessage objectMessage = (ObjectMessage) message;
        final String correlationUid = objectMessage.getJMSCorrelationID();
        LOGGER.info("objectMessage CorrelationUID: {}", correlationUid);
        final MessageProcessor processor = this.messageProcessorMap.getMessageProcessor(objectMessage);
        processor.processMessage(objectMessage);
    } catch (final JMSException ex) {
        LOGGER.error("Exception: {} ", ex.getMessage(), ex);
    }
}
Also used : ObjectMessage(javax.jms.ObjectMessage) MessageProcessor(org.opensmartgridplatform.shared.infra.jms.MessageProcessor) JMSException(javax.jms.JMSException)

Aggregations

ObjectMessage (javax.jms.ObjectMessage)28 MessageProcessor (org.opensmartgridplatform.shared.infra.jms.MessageProcessor)28 JMSException (javax.jms.JMSException)26 NotSupportedException (org.opensmartgridplatform.shared.exceptionhandling.NotSupportedException)2 MessageMetadata (org.opensmartgridplatform.shared.infra.jms.MessageMetadata)2 Test (org.junit.jupiter.api.Test)1 GetHealthStatusRequestMessageProcessor (org.opensmartgridplatform.adapter.protocol.iec60870.infra.messaging.processors.GetHealthStatusRequestMessageProcessor)1 GetHealthStatusRequestDto (org.opensmartgridplatform.dto.da.GetHealthStatusRequestDto)1 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)1 MessageType (org.opensmartgridplatform.shared.infra.jms.MessageType)1 ObjectMessageBuilder (org.opensmartgridplatform.shared.infra.jms.ObjectMessageBuilder)1 RequestMessage (org.opensmartgridplatform.shared.infra.jms.RequestMessage)1