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);
}
}
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 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 MessageProcessor processor = this.messageProcessorMap.getMessageProcessor(objectMessage);
processor.processMessage(objectMessage);
} catch (final Exception e) {
/*
* Just catch and log any exception. There is no response flow for
* requests coming in from OSGP-Core, where exceptions should be
* rapported to.
*/
LOGGER.error("Exception while handling a request from OSGP-Core: ", 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) {
ObjectMessage objectMessage = null;
MessageMetadata messageMetadata = null;
try {
objectMessage = (ObjectMessage) message;
messageMetadata = MessageMetadata.fromMessage(objectMessage);
} catch (final Exception e) {
LOGGER.error("UNRECOVERABLE ERROR, unable to read JMS message instance, giving up.", e);
return;
}
final String correlationUid = messageMetadata.getCorrelationUid();
final String deviceIdentification = messageMetadata.getDeviceIdentification();
try {
LOGGER.info("Received message [correlationUid={}, messageType={}, messagePriority={}] for device {}", correlationUid, messageMetadata.getMessageType(), messageMetadata.getMessagePriority(), deviceIdentification);
this.pendingRequestsQueue.enqueue(deviceIdentification, correlationUid);
final MessageProcessor processor = this.messageProcessorMap.getMessageProcessor(objectMessage);
processor.processMessage(objectMessage);
} catch (final IllegalArgumentException | JMSException e) {
this.pendingRequestsQueue.remove(deviceIdentification, correlationUid);
LOGGER.error("Unexpected exception for message [correlationUid={}]", correlationUid, e);
this.sendNotSupportedException(objectMessage, messageMetadata);
}
}
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);
}
}
Aggregations