use of org.opensmartgridplatform.shared.infra.jms.MessageProcessor in project open-smart-grid-platform by OSGP.
the class OsgpResponseMessageListener method onMessage.
@Override
public void onMessage(final Message message) {
try {
LOGGER.info("[{}] - Received message of type: {}", message.getJMSCorrelationID(), message.getJMSType());
final MessageMetadata metadata = MessageMetadata.fromMessage(message);
final ObjectMessage objectMessage = (ObjectMessage) message;
final MessageProcessor messageProcessor = this.messageProcessorMap.getMessageProcessor(objectMessage);
if (messageProcessor != null) {
messageProcessor.processMessage(objectMessage);
} else {
LOGGER.error("[{}] - Unknown messagetype {}", metadata.getCorrelationUid(), metadata.getMessageType());
}
} 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 DeviceRequestMessageListener 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.dlmsRequestMessageProcessorMap.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 DeviceRequestMessageListener method onMessage.
@Override
public void onMessage(final Message message) {
final ObjectMessage objectMessage = (ObjectMessage) message;
String messageType = null;
final int messagePriority;
try {
messageType = message.getJMSType();
messagePriority = message.getJMSPriority();
LOGGER.info("Received message of type: {} with message priority: {}", messageType, messagePriority);
final MessageProcessor processor = this.oslpRequestMessageProcessorMap.getMessageProcessor(objectMessage);
processor.processMessage(objectMessage);
} catch (final JMSException ex) {
LOGGER.error("Unexpected JMSException during onMessage(Message)", ex);
this.sendException(objectMessage, ex, "JMSException while processing message");
} catch (final IllegalArgumentException e) {
LOGGER.error("Unexpected IllegalArgumentException during onMessage(Message)", e);
this.sendException(objectMessage, new NotSupportedException(ComponentType.PROTOCOL_OSLP, messageType), "Unsupported device function: " + messageType);
}
}
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.osgpCoreResponseMessageProcessorMap.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 OsgpCoreRequestMessageListener method onMessage.
@Override
public void onMessage(final Message message) {
try {
LOGGER.info("Received message of type: {}", message.getJMSType());
final ObjectMessage objectMessage = (ObjectMessage) message;
final MessageType messageType = MessageType.valueOf(objectMessage.getJMSType());
final MessageProcessor messageProcessor = this.domainCoreDeviceRequestMessageProcessorMap.getMessageProcessor(messageType);
messageProcessor.processMessage(objectMessage);
} catch (final JMSException e) {
LOGGER.error("Exception: {}", e.getMessage(), e);
}
}
Aggregations