Example usage for javax.jms ObjectMessage getObject

List of usage examples for javax.jms ObjectMessage getObject

Introduction

In this page you can find the example usage for javax.jms ObjectMessage getObject.

Prototype


Serializable getObject() throws JMSException;

Source Link

Document

Gets the serializable object containing this message's data.

Usage

From source file:com.chinamobile.bcbsp.comm.ConsumerTool.java

/**
 * Put message into messageQueue and update information.
 *//*  w w  w.  j  av  a 2s .c  om*/
public void onMessage(Message message) {
    messagesReceived++;
    try {
        if (message instanceof ObjectMessage) {
            ObjectMessage objMsg = (ObjectMessage) message;
            BSPMessagesPack msgPack = (BSPMessagesPack) objMsg.getObject();
            IMessage bspMsg;
            Iterator<IMessage> iter = msgPack.getPack().iterator();
            while (iter.hasNext()) {
                bspMsg = iter.next();
                String vertexID = bspMsg.getDstVertexID();
                this.messageQueues.incomeAMessage(vertexID, bspMsg);
                this.messageCount++;
                this.messageBytesCount += bspMsg.size();
            }
        } else {
            // Message received is not ObjectMessage.
            LOG.error("[ConsumerTool] Message received is not ObjectMessage!");
        }
        if (message.getJMSReplyTo() != null) {
            replyProducer.send(message.getJMSReplyTo(),
                    session.createTextMessage("Reply: " + message.getJMSMessageID()));
        }
        if (transacted) {
            if ((messagesReceived % batch) == 0) {
                LOG.info("Commiting transaction for last " + batch + " messages; messages so far = "
                        + messagesReceived);
                session.commit();
            }
        } else if (ackMode == Session.CLIENT_ACKNOWLEDGE) {
            if ((messagesReceived % batch) == 0) {
                LOG.info("Acknowledging last " + batch + " messages; messages so far = " + messagesReceived);
                message.acknowledge();
            }
        }
    } catch (JMSException e) {
        throw new RuntimeException("[ConsumerTool] caught: ", e);
    } finally {
        if (sleepTime > 0) {
            try {
                Thread.sleep(sleepTime);
            } catch (InterruptedException e) {
                LOG.error("[ConsumerTool] Message received not ObjectMessage!", e);
                throw new RuntimeException("[ConsumerTool] Message received not ObjectMessage! s", e);
            }
        }
    }
}

From source file:com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.DeviceRequestMessageListener.java

private void sendException(final ObjectMessage objectMessage, final Exception exception,
        final String errorMessage) {
    try {/*from w ww .j  ava  2s.c  o  m*/
        final String domain = objectMessage.getStringProperty(Constants.DOMAIN);
        final String domainVersion = objectMessage.getStringProperty(Constants.DOMAIN_VERSION);
        final ResponseMessageResultType result = ResponseMessageResultType.NOT_OK;
        final OsgpException osgpException = new OsgpException(ComponentType.PROTOCOL_OSLP, errorMessage,
                exception);
        final Serializable dataObject = objectMessage.getObject();

        final DeviceMessageMetadata deviceMessageMetadata = new DeviceMessageMetadata(objectMessage);
        final ProtocolResponseMessage protocolResponseMessage = new ProtocolResponseMessage.Builder()
                .deviceMessageMetadata(deviceMessageMetadata).domain(domain).domainVersion(domainVersion)
                .result(result).osgpException(osgpException).dataObject(dataObject).scheduled(false).build();

        this.deviceResponseMessageSender.send(protocolResponseMessage);
    } catch (final Exception e) {
        LOGGER.error("Unexpected error during sendException(ObjectMessage, Exception)", e);
    }
}

From source file:com.alliander.osgp.adapter.protocol.iec61850.infra.messaging.DeviceRequestMessageListener.java

private void sendException(final ObjectMessage objectMessage, final Exception exception,
        final String errorMessage) {
    try {/*from  w ww.  j ava2  s . com*/
        final String domain = objectMessage.getStringProperty(Constants.DOMAIN);
        final String domainVersion = objectMessage.getStringProperty(Constants.DOMAIN_VERSION);
        final ResponseMessageResultType result = ResponseMessageResultType.NOT_OK;
        final OsgpException osgpException = new OsgpException(ComponentType.PROTOCOL_IEC61850, errorMessage,
                exception);
        final Serializable dataObject = objectMessage.getObject();

        final DeviceMessageMetadata deviceMessageMetadata = new DeviceMessageMetadata(objectMessage);
        final ProtocolResponseMessage protocolResponseMessage = new ProtocolResponseMessage.Builder()
                .deviceMessageMetadata(deviceMessageMetadata).domain(domain).domainVersion(domainVersion)
                .result(result).osgpException(osgpException).dataObject(dataObject).scheduled(false).build();

        this.deviceResponseMessageSender.send(protocolResponseMessage);
    } catch (final Exception e) {
        LOGGER.error("Unexpected error during sendException(ObjectMessage, Exception)", e);
    }
}

From source file:hermes.renderers.DefaultMessageRenderer.java

/**
 * Depending on configuration, show the object via toString() or a list of
 * properties./*from   www  .j a  v a  2  s .c om*/
 * 
 * @param objectMessage
 * @return
 * @throws JMSException
 * @throws IllegalAccessException
 * @throws InvocationTargetException
 * @throws NoSuchMethodException
 */
protected JComponent handleObjectMessage(final ObjectMessage objectMessage)
        throws JMSException, IllegalAccessException, InvocationTargetException, NoSuchMethodException {
    //
    // Unserialize the object and display all its properties

    Serializable obj = objectMessage.getObject();

    if (obj instanceof JComponent) {
        return (JComponent) obj;
    } else {
        JTextArea textPane = new JTextArea();
        StringBuffer buffer = new StringBuffer();
        MyConfig currentConfig = (MyConfig) getConfig();

        if (obj == null) {
            buffer.append("Payload is null");
        } else if (currentConfig.isToStringOnObjectMessage()) {
            buffer.append(obj.toString());
        } else {
            buffer.append(obj.toString()).append("\n\nProperty list\n");

            for (Iterator iter = PropertyUtils.describe(obj).entrySet().iterator(); iter.hasNext();) {
                Map.Entry entry = (Map.Entry) iter.next();

                buffer.append(entry.getKey().toString()).append("=").append(entry.getValue()).append("\n");
            }
        }

        textPane.setEditable(false);
        textPane.setText(buffer.toString());

        return textPane;
    }
}

From source file:hermes.impl.DefaultXMLHelper.java

public XMLMessage createXMLMessage(ObjectFactory factory, Message message)
        throws JMSException, IOException, EncoderException {
    try {/*w w  w. j  a va2 s  .  c o  m*/
        XMLMessage rval = factory.createXMLMessage();

        if (message instanceof TextMessage) {
            rval = factory.createXMLTextMessage();

            XMLTextMessage textRval = (XMLTextMessage) rval;
            TextMessage textMessage = (TextMessage) message;

            if (isBase64EncodeTextMessages()) {
                byte[] bytes = base64EncoderTL.get().encode(textMessage.getText().getBytes());
                textRval.setText(new String(bytes, "ASCII"));
                textRval.setCodec(BASE64_CODEC);
            } else {
                textRval.setText(textMessage.getText());
            }
        } else if (message instanceof MapMessage) {
            rval = factory.createXMLMapMessage();

            XMLMapMessage mapRval = (XMLMapMessage) rval;
            MapMessage mapMessage = (MapMessage) message;

            for (Enumeration iter = mapMessage.getMapNames(); iter.hasMoreElements();) {
                String propertyName = (String) iter.nextElement();
                Object propertyValue = mapMessage.getObject(propertyName);
                Property xmlProperty = factory.createProperty();

                if (propertyValue != null) {
                    xmlProperty.setValue(propertyValue.toString());
                    xmlProperty.setType(propertyValue.getClass().getName());
                }
                xmlProperty.setName(propertyName);

                mapRval.getBodyProperty().add(xmlProperty);
            }
        } else if (message instanceof BytesMessage) {
            rval = factory.createXMLBytesMessage();

            XMLBytesMessage bytesRval = (XMLBytesMessage) rval;
            BytesMessage bytesMessage = (BytesMessage) message;
            ByteArrayOutputStream bosream = new ByteArrayOutputStream();

            bytesMessage.reset();

            try {
                for (;;) {
                    bosream.write(bytesMessage.readByte());
                }
            } catch (MessageEOFException ex) {
                // NOP
            }

            bytesRval.setBytes(new String(base64EncoderTL.get().encode(bosream.toByteArray())));
        } else if (message instanceof ObjectMessage) {
            rval = factory.createXMLObjectMessage();

            XMLObjectMessage objectRval = (XMLObjectMessage) rval;
            ObjectMessage objectMessage = (ObjectMessage) message;

            ByteArrayOutputStream bostream = new ByteArrayOutputStream();
            ObjectOutputStream oostream = new ObjectOutputStream(bostream);

            oostream.writeObject(objectMessage.getObject());
            oostream.flush();
            byte b[] = base64EncoderTL.get().encode(bostream.toByteArray());
            String s = new String(b, "ASCII");
            objectRval.setObject(s);
        }

        if (message.getJMSReplyTo() != null) {
            rval.setJMSReplyTo(JMSUtils.getDestinationName(message.getJMSReplyTo()));
            rval.setJMSReplyToDomain(Domain.getDomain(message.getJMSReplyTo()).getId());
        }

        // try/catch each individually as we sometime find some JMS
        // providers
        // can barf
        try {
            rval.setJMSDeliveryMode(message.getJMSDeliveryMode());
        } catch (JMSException ex) {
            log.error(ex.getMessage(), ex);
        }

        try {
            rval.setJMSExpiration(message.getJMSExpiration());
        } catch (JMSException ex) {
            log.error(ex.getMessage(), ex);
        }

        try {
            rval.setJMSMessageID(message.getJMSMessageID());
        } catch (JMSException ex) {
            log.error(ex.getMessage(), ex);
        }

        try {
            rval.setJMSPriority(message.getJMSPriority());
        } catch (JMSException ex) {
            log.error(ex.getMessage(), ex);
        }

        try {
            rval.setJMSRedelivered(message.getJMSRedelivered());
        } catch (JMSException ex) {
            log.error(ex.getMessage(), ex);
        } catch (IllegalStateException ex) {
            // http://hermesjms.com/forum/viewtopic.php?f=4&t=346

            log.error(ex.getMessage(), ex);
        }

        try {
            rval.setJMSTimestamp(message.getJMSTimestamp());
        } catch (JMSException ex) {
            log.error(ex.getMessage(), ex);
        }

        try {
            rval.setJMSType(message.getJMSType());
        } catch (JMSException ex) {
            log.error(ex.getMessage(), ex);
        }

        try {
            rval.setJMSCorrelationID(message.getJMSCorrelationID());
        } catch (JMSException ex) {
            log.error(ex.getMessage(), ex);
        }

        try {
            if (message.getJMSDestination() != null) {
                rval.setJMSDestination(JMSUtils.getDestinationName(message.getJMSDestination()));
                rval.setFromQueue(JMSUtils.isQueue(message.getJMSDestination()));
            }
        } catch (JMSException ex) {
            log.error(ex.getMessage(), ex);
        }

        for (final Enumeration iter = message.getPropertyNames(); iter.hasMoreElements();) {
            String propertyName = (String) iter.nextElement();

            if (!propertyName.startsWith("JMS")) {
                Object propertyValue = message.getObjectProperty(propertyName);
                Property property = factory.createProperty();

                property.setName(propertyName);

                if (propertyValue != null) {
                    property.setValue(StringEscapeUtils.escapeXml(propertyValue.toString()));
                    property.setType(propertyValue.getClass().getName());
                }

                rval.getHeaderProperty().add(property);
            }
        }

        return rval;
    } catch (Exception ex) {
        throw new HermesException(ex);
    }
}

From source file:org.osgp.adapter.protocol.dlms.infra.messaging.DeviceRequestMessageProcessor.java

@Override
public void processMessage(final ObjectMessage message) throws JMSException {
    LOGGER.debug("Processing {} request message", this.deviceRequestMessageType.name());
    final DlmsDeviceMessageMetadata messageMetadata = new DlmsDeviceMessageMetadata();

    ClientConnection conn = null;/*w w  w  .  j  a  v a2s .  co  m*/
    DlmsDevice device = null;

    try {
        // Handle message
        messageMetadata.handleMessage(message);

        LOGGER.info("{} called for device: {} for organisation: {}", message.getJMSType(),
                messageMetadata.getDeviceIdentification(), messageMetadata.getOrganisationIdentification());

        device = this.domainHelperService.findDlmsDevice(messageMetadata);
        conn = this.dlmsConnectionFactory.getConnection(device);

        final Serializable response = this.handleMessage(conn, device, message.getObject());

        // Send response
        this.sendResponseMessage(messageMetadata, ResponseMessageResultType.OK, null,
                this.responseMessageSender, response);
    } catch (final ConnectionException exception) {
        // Retry / redeliver by throwing RuntimeException.
        LOGGER.info("ConnectionException occurred, JMS will catch this exception.");
        throw exception;
    } catch (final JMSException exception) {
        this.logJmsException(LOGGER, exception, messageMetadata);
    } catch (final Exception exception) {
        // Return original request + exception
        LOGGER.error("Unexpected exception during {}", this.deviceRequestMessageType.name(), exception);

        final OsgpException ex = this.osgpExceptionConverter.ensureOsgpOrTechnicalException(exception);
        this.sendResponseMessage(messageMetadata, ResponseMessageResultType.NOT_OK, ex,
                this.responseMessageSender, message.getObject());
    } finally {
        if (conn != null) {
            LOGGER.info("Closing connection with {}", device.getDeviceIdentification());
            conn.close();
        }
    }
}

From source file:com.egt.web.proceso.ArchivoDatosExt4.java

private AbstractMessage requestReply(AbstractMessage message) throws Exception {
    ObjectMessage solicitud = this.messenger.postRequest(message);
    ObjectMessage respuesta = this.messenger.receiveReply(solicitud);
    AbstractMessage mensaje = respuesta == null ? (AbstractMessage) solicitud.getObject()
            : (AbstractMessage) respuesta.getObject();
    /**///from   ww w.ja va  2  s . com
    TLC.getBitacora().add(mensaje);
    return mensaje;
}

From source file:com.alliander.osgp.adapter.protocol.iec61850.infra.messaging.processors.CommonSetConfigurationRequestMessageProcessor.java

@Override
public void processMessage(final ObjectMessage message) {
    LOGGER.debug("Processing common set configuration message");

    String correlationUid = null;
    String domain = null;//from ww  w.j av  a 2s . c  om
    String domainVersion = null;
    String messageType = null;
    String organisationIdentification = null;
    String deviceIdentification = null;
    String ipAddress = null;
    Boolean isScheduled = null;
    int retryCount = 0;
    ConfigurationDto configuration = null;

    try {
        correlationUid = message.getJMSCorrelationID();
        domain = message.getStringProperty(Constants.DOMAIN);
        domainVersion = message.getStringProperty(Constants.DOMAIN_VERSION);
        messageType = message.getJMSType();
        organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION);
        deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION);
        ipAddress = message.getStringProperty(Constants.IP_ADDRESS);
        isScheduled = message.getBooleanProperty(Constants.IS_SCHEDULED);
        retryCount = message.getIntProperty(Constants.RETRY_COUNT);
        configuration = (ConfigurationDto) message.getObject();

    } catch (final JMSException e) {
        LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
        LOGGER.debug("correlationUid: {}", correlationUid);
        LOGGER.debug("domain: {}", domain);
        LOGGER.debug("domainVersion: {}", domainVersion);
        LOGGER.debug("messageType: {}", messageType);
        LOGGER.debug("organisationIdentification: {}", organisationIdentification);
        LOGGER.debug("deviceIdentification: {}", deviceIdentification);
        LOGGER.debug("ipAddress: {}", ipAddress);
        LOGGER.debug("scheduled: {}", isScheduled);
        return;
    }
    final RequestMessageData requestMessageData = new RequestMessageData(null, domain, domainVersion,
            messageType, retryCount, isScheduled, correlationUid, organisationIdentification,
            deviceIdentification);

    LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion);

    final DeviceResponseHandler deviceResponseHandler = new DeviceResponseHandler() {

        @Override
        public void handleResponse(final DeviceResponse deviceResponse) {
            CommonSetConfigurationRequestMessageProcessor.this.handleEmptyDeviceResponse(deviceResponse,
                    CommonSetConfigurationRequestMessageProcessor.this.responseMessageSender,
                    requestMessageData.getDomain(), requestMessageData.getDomainVersion(),
                    requestMessageData.getMessageType(), requestMessageData.getRetryCount());
        }

        @Override
        public void handleException(final Throwable t, final DeviceResponse deviceResponse,
                final boolean expected) {
            if (expected) {
                CommonSetConfigurationRequestMessageProcessor.this.handleExpectedError(
                        new ConnectionFailureException(ComponentType.PROTOCOL_IEC61850, t.getMessage()),
                        requestMessageData.getCorrelationUid(),
                        requestMessageData.getOrganisationIdentification(),
                        requestMessageData.getDeviceIdentification(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType());
            } else {
                CommonSetConfigurationRequestMessageProcessor.this.handleUnExpectedError(deviceResponse, t,
                        requestMessageData.getMessageData(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType(),
                        requestMessageData.isScheduled(), requestMessageData.getRetryCount());
            }
        }

    };

    final SetConfigurationDeviceRequest deviceRequest = new SetConfigurationDeviceRequest(
            organisationIdentification, deviceIdentification, correlationUid, configuration, domain,
            domainVersion, messageType, ipAddress, retryCount, isScheduled);

    this.deviceService.setConfiguration(deviceRequest, deviceResponseHandler);

}

From source file:com.alliander.osgp.adapter.protocol.iec61850.infra.messaging.processors.CommonUpdateFirmwareRequestMessageProcessor.java

@Override
public void processMessage(final ObjectMessage message) {
    LOGGER.debug("Processing common update firmware request message");

    String correlationUid = null;
    String domain = null;/*from   w  ww . j a v a  2 s  .com*/
    String domainVersion = null;
    String messageType = null;
    String organisationIdentification = null;
    String deviceIdentification = null;
    String ipAddress = null;
    Boolean isScheduled = null;
    int retryCount = 0;
    String firmwareIdentification = null;

    try {
        correlationUid = message.getJMSCorrelationID();
        domain = message.getStringProperty(Constants.DOMAIN);
        domainVersion = message.getStringProperty(Constants.DOMAIN_VERSION);
        messageType = message.getJMSType();
        organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION);
        deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION);
        ipAddress = message.getStringProperty(Constants.IP_ADDRESS);
        isScheduled = message.getBooleanProperty(Constants.IS_SCHEDULED);
        retryCount = message.getIntProperty(Constants.RETRY_COUNT);
        firmwareIdentification = (String) message.getObject();
    } catch (final JMSException e) {
        LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
        LOGGER.debug("correlationUid: {}", correlationUid);
        LOGGER.debug("domain: {}", domain);
        LOGGER.debug("domainVersion: {}", domainVersion);
        LOGGER.debug("messageType: {}", messageType);
        LOGGER.debug("organisationIdentification: {}", organisationIdentification);
        LOGGER.debug("deviceIdentification: {}", deviceIdentification);
        LOGGER.debug("ipAddress: {}", ipAddress);
        LOGGER.debug("scheduled: {}", isScheduled);
        return;
    }

    final RequestMessageData requestMessageData = new RequestMessageData(null, domain, domainVersion,
            messageType, retryCount, isScheduled, correlationUid, organisationIdentification,
            deviceIdentification);

    LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion);

    final DeviceResponseHandler deviceResponseHandler = new DeviceResponseHandler() {

        @Override
        public void handleResponse(final DeviceResponse deviceResponse) {
            CommonUpdateFirmwareRequestMessageProcessor.this.handleEmptyDeviceResponse(deviceResponse,
                    CommonUpdateFirmwareRequestMessageProcessor.this.responseMessageSender,
                    requestMessageData.getDomain(), requestMessageData.getDomainVersion(),
                    requestMessageData.getMessageType(), requestMessageData.getRetryCount());
        }

        @Override
        public void handleException(final Throwable t, final DeviceResponse deviceResponse,
                final boolean expected) {
            if (expected) {
                CommonUpdateFirmwareRequestMessageProcessor.this.handleExpectedError(
                        new ConnectionFailureException(ComponentType.PROTOCOL_IEC61850, t.getMessage()),
                        requestMessageData.getCorrelationUid(),
                        requestMessageData.getOrganisationIdentification(),
                        requestMessageData.getDeviceIdentification(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType());
            } else {
                CommonUpdateFirmwareRequestMessageProcessor.this.handleUnExpectedError(deviceResponse, t,
                        requestMessageData.getMessageData(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType(),
                        requestMessageData.isScheduled(), requestMessageData.getRetryCount());
            }
        }

    };

    final UpdateFirmwareDeviceRequest deviceRequest = new UpdateFirmwareDeviceRequest(
            organisationIdentification, deviceIdentification, correlationUid, this.firmwareLocation.getDomain(),
            this.firmwareLocation.getFullPath(firmwareIdentification), domain, domainVersion, messageType,
            ipAddress, retryCount, isScheduled);

    this.deviceService.updateFirmware(deviceRequest, deviceResponseHandler);
}

From source file:com.alliander.osgp.adapter.protocol.iec61850.infra.messaging.processors.CommonUpdateDeviceSslCertificationRequestMessageProcessor.java

@Override
public void processMessage(final ObjectMessage message) {
    LOGGER.debug("Processing common update device ssl certification message");

    String correlationUid = null;
    String domain = null;//from  w  w  w.ja  v a2  s . c o  m
    String domainVersion = null;
    String messageType = null;
    String organisationIdentification = null;
    String deviceIdentification = null;
    String ipAddress = null;
    Boolean isScheduled = null;
    int retryCount = 0;
    CertificationDto certification = null;

    try {
        correlationUid = message.getJMSCorrelationID();
        domain = message.getStringProperty(Constants.DOMAIN);
        domainVersion = message.getStringProperty(Constants.DOMAIN_VERSION);
        messageType = message.getJMSType();
        organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION);
        deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION);
        ipAddress = message.getStringProperty(Constants.IP_ADDRESS);
        isScheduled = message.getBooleanProperty(Constants.IS_SCHEDULED);
        retryCount = message.getIntProperty(Constants.RETRY_COUNT);
        certification = (CertificationDto) message.getObject();
    } catch (final JMSException e) {
        LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
        LOGGER.debug("correlationUid: {}", correlationUid);
        LOGGER.debug("domain: {}", domain);
        LOGGER.debug("domainVersion: {}", domainVersion);
        LOGGER.debug("messageType: {}", messageType);
        LOGGER.debug("organisationIdentification: {}", organisationIdentification);
        LOGGER.debug("deviceIdentification: {}", deviceIdentification);
        LOGGER.debug("ipAddress: {}", ipAddress);
        LOGGER.debug("scheduled: {}", isScheduled);
        return;
    }

    final RequestMessageData requestMessageData = new RequestMessageData(null, domain, domainVersion,
            messageType, retryCount, isScheduled, correlationUid, organisationIdentification,
            deviceIdentification);

    LOGGER.info("Calling DeviceService function: {} for domain: {} {}", messageType, domain, domainVersion);

    final DeviceResponseHandler deviceResponseHandler = new DeviceResponseHandler() {

        @Override
        public void handleResponse(final DeviceResponse deviceResponse) {
            CommonUpdateDeviceSslCertificationRequestMessageProcessor.this.handleEmptyDeviceResponse(
                    deviceResponse,
                    CommonUpdateDeviceSslCertificationRequestMessageProcessor.this.responseMessageSender,
                    requestMessageData.getDomain(), requestMessageData.getDomainVersion(),
                    requestMessageData.getMessageType(), requestMessageData.getRetryCount());
        }

        @Override
        public void handleException(final Throwable t, final DeviceResponse deviceResponse,
                final boolean expected) {
            if (expected) {
                CommonUpdateDeviceSslCertificationRequestMessageProcessor.this.handleExpectedError(
                        new ConnectionFailureException(ComponentType.PROTOCOL_IEC61850, t.getMessage()),
                        requestMessageData.getCorrelationUid(),
                        requestMessageData.getOrganisationIdentification(),
                        requestMessageData.getDeviceIdentification(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType());
            } else {
                CommonUpdateDeviceSslCertificationRequestMessageProcessor.this.handleUnExpectedError(
                        deviceResponse, t, requestMessageData.getMessageData(), requestMessageData.getDomain(),
                        requestMessageData.getDomainVersion(), requestMessageData.getMessageType(),
                        requestMessageData.isScheduled(), requestMessageData.getRetryCount());
            }
        }
    };

    final UpdateDeviceSslCertificationDeviceRequest deviceRequest = new UpdateDeviceSslCertificationDeviceRequest(
            organisationIdentification, deviceIdentification, correlationUid, certification, domain,
            domainVersion, messageType, ipAddress, retryCount, isScheduled);

    this.deviceService.updateDeviceSslCertification(deviceRequest, deviceResponseHandler);

}