Search in sources :

Example 1 with SetEventNotificationsDeviceRequest

use of org.opensmartgridplatform.adapter.protocol.oslp.elster.device.requests.SetEventNotificationsDeviceRequest in project open-smart-grid-platform by OSGP.

the class CommonSetEventNotificationsRequestMessageProcessor method processMessage.

@Override
public void processMessage(final ObjectMessage message) {
    LOGGER.debug("Processing common set event notifications request message");
    MessageMetadata messageMetadata;
    EventNotificationMessageDataContainerDto eventNotificationMessageDataContainer;
    try {
        messageMetadata = MessageMetadata.fromMessage(message);
        eventNotificationMessageDataContainer = (EventNotificationMessageDataContainerDto) message.getObject();
    } catch (final JMSException e) {
        LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
        return;
    }
    try {
        this.printDomainInfo(messageMetadata.getMessageType(), messageMetadata.getDomain(), messageMetadata.getDomainVersion());
        final SetEventNotificationsDeviceRequest deviceRequest = new SetEventNotificationsDeviceRequest(DeviceRequest.newBuilder().messageMetaData(messageMetadata), eventNotificationMessageDataContainer);
        this.deviceService.setEventNotifications(deviceRequest);
    } catch (final RuntimeException e) {
        this.handleError(e, messageMetadata);
    }
}
Also used : MessageMetadata(org.opensmartgridplatform.shared.infra.jms.MessageMetadata) SetEventNotificationsDeviceRequest(org.opensmartgridplatform.adapter.protocol.oslp.elster.device.requests.SetEventNotificationsDeviceRequest) JMSException(javax.jms.JMSException) EventNotificationMessageDataContainerDto(org.opensmartgridplatform.dto.valueobjects.EventNotificationMessageDataContainerDto)

Aggregations

JMSException (javax.jms.JMSException)1 SetEventNotificationsDeviceRequest (org.opensmartgridplatform.adapter.protocol.oslp.elster.device.requests.SetEventNotificationsDeviceRequest)1 EventNotificationMessageDataContainerDto (org.opensmartgridplatform.dto.valueobjects.EventNotificationMessageDataContainerDto)1 MessageMetadata (org.opensmartgridplatform.shared.infra.jms.MessageMetadata)1