class DomainResponseMessageProcessor implements MessageProcessor {

    @Override
    public void processMessage(final ObjectMessage message) {
        LOGGER.debug("Processing distribution automation response message");

        String correlationUid = null;
        String messageType = null;
        String organisationIdentification = null;
        String deviceIdentification = null;

        String notificationMessage;
        NotificationType notificationType;
        ResponseMessageResultType resultType;
        String resultDescription;
        Serializable dataObject;

        try {
            correlationUid = message.getJMSCorrelationID();
            organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION);
            deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION);

            messageType = message.getJMSType();
            validateMessageType(messageType);

            resultType = ResponseMessageResultType.valueOf(message.getStringProperty(Constants.RESULT));
            resultDescription = message.getStringProperty(Constants.DESCRIPTION);

            notificationMessage = message.getStringProperty(Constants.DESCRIPTION);
            notificationType = NotificationType.valueOf(messageType);

            dataObject = message.getObject();
        } catch (final IllegalArgumentException e) {
            LOGGER.error("UNRECOVERABLE ERROR, received messageType {} is unknown.", messageType, e);
            logDebugInformation(messageType, correlationUid, organisationIdentification, deviceIdentification);

            return;
        } catch (final JMSException e) {
            LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
            logDebugInformation(messageType, correlationUid, organisationIdentification, deviceIdentification);

            return;
        }

        try {
            LOGGER.info("Calling application service function to handle response: {}", messageType);

            final CorrelationIds ids = new CorrelationIds(organisationIdentification, deviceIdentification,
                    correlationUid);
            this.handleMessage(ids, messageType, resultType, resultDescription, dataObject);

            // Send notification indicating data is available.
            this.notificationService.sendNotification(this.webserviceNotificationOrganisation, deviceIdentification,
                    resultType.name(), correlationUid, notificationMessage, notificationType);

        } catch (final RuntimeException e) {
            handleError(e, correlationUid, notificationType);
        }
    }

}