Search in sources :

Example 1 with GetPQValuesRequest

use of org.opensmartgridplatform.domain.da.valueobjects.GetPQValuesRequest in project open-smart-grid-platform by OSGP.

the class GetPQValuesRequestMessageProcessor method processMessage.

@Override
public void processMessage(final ObjectMessage message) {
    LOGGER.info("Processing DA Get PQ Values request message");
    String correlationUid = null;
    String messageType = null;
    String organisationIdentification = null;
    String deviceIdentification = null;
    GetPQValuesRequest getPQValuesRequest = null;
    try {
        correlationUid = message.getJMSCorrelationID();
        messageType = message.getJMSType();
        organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION);
        deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION);
        if (message.getObject() instanceof GetPQValuesRequest) {
            getPQValuesRequest = (GetPQValuesRequest) message.getObject();
        }
    } catch (final JMSException e) {
        LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
        LOGGER.debug("correlationUid: {}", correlationUid);
        LOGGER.debug("messageType: {}", messageType);
        LOGGER.debug("organisationIdentification: {}", organisationIdentification);
        LOGGER.debug("deviceIdentification: {}", deviceIdentification);
        return;
    }
    try {
        LOGGER.info("Calling application service function: {}", messageType);
        final CorrelationIds ids = new CorrelationIds(organisationIdentification, deviceIdentification, correlationUid);
        this.monitoringService.getPQValues(ids, messageType, getPQValuesRequest);
    } catch (final Exception e) {
        this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, messageType);
    }
}
Also used : GetPQValuesRequest(org.opensmartgridplatform.domain.da.valueobjects.GetPQValuesRequest) JMSException(javax.jms.JMSException) CorrelationIds(org.opensmartgridplatform.shared.infra.jms.CorrelationIds) JMSException(javax.jms.JMSException)

Aggregations

JMSException (javax.jms.JMSException)1 GetPQValuesRequest (org.opensmartgridplatform.domain.da.valueobjects.GetPQValuesRequest)1 CorrelationIds (org.opensmartgridplatform.shared.infra.jms.CorrelationIds)1