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);
}
}
use of org.opensmartgridplatform.shared.infra.jms.MessageProcessor in project open-smart-grid-platform by OSGP.
the class ProtocolRequestMessageListener method onMessage.
@Override
public void onMessage(final Message message) {
try {
LOGGER.info("Received message of type: {}", message.getJMSType());
final ObjectMessage objectMessage = (ObjectMessage) message;
// message processor.
try {
final MessageProcessor processor = this.protocolRequestMessageProcessorMap.getMessageProcessor(objectMessage);
processor.processMessage(objectMessage);
} catch (final JMSException ex) {
LOGGER.error("JMSException", ex);
// The message needs to be sent to a domain adapter.
this.sendMessageToDomainAdapter((RequestMessage) objectMessage.getObject(), message.getJMSType());
}
} catch (final JMSException e) {
LOGGER.error("Exception: {}, StackTrace: {}", e.getMessage(), e.getStackTrace(), e);
}
}
use of org.opensmartgridplatform.shared.infra.jms.MessageProcessor in project open-smart-grid-platform by OSGP.
the class DeviceRequestMessageListener method onMessage.
@Override
public void onMessage(final Message message) {
final ObjectMessage objectMessage = (ObjectMessage) message;
String correlationUid = null;
String messageType = null;
final int messagePriority;
try {
correlationUid = message.getJMSCorrelationID();
messageType = message.getJMSType();
messagePriority = message.getJMSPriority();
LOGGER.info("Received message [correlationUid={}, messageType={}, messagePriority={}]", correlationUid, messageType, messagePriority);
final MessageProcessor processor = this.iec61850RequestMessageProcessorMap.getMessageProcessor(objectMessage);
processor.processMessage(objectMessage);
} catch (final IllegalArgumentException | JMSException e) {
LOGGER.error("Unexpected exception for message [correlationUid={}]", correlationUid, e);
this.createAndSendException(objectMessage, messageType);
}
}
Aggregations