Source:
public void processMessage(final ObjectMessage message) throws JMSException { LOGGER.debug("Processing smart metering actual meter reads response message"); String correlationUid = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; String result = null; String notificationMessage = null; NotificationType notificationType = null; try { correlationUid = message.getJMSCorrelationID(); messageType = message.getJMSType(); organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION); deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION); result = message.getStringProperty(Constants.RESULT); notificationMessage = message.getStringProperty(Constants.DESCRIPTION); notificationType = NotificationType.valueOf(messageType); } 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 to handle response: {}", messageType); if (message.getObject() instanceof ActualMeterReads) { final ActualMeterReads data = (ActualMeterReads) message.getObject(); final MeterResponseData meterResponseData = new MeterResponseData(organisationIdentification, messageType, deviceIdentification, correlationUid, data); this.meterResponseDataRepository.save(meterResponseData); } else { MeterReadsGas meterReadsGas = (MeterReadsGas) message.getObject(); final MeterResponseData meterResponseData = new MeterResponseData(organisationIdentification, messageType, deviceIdentification, correlationUid, meterReadsGas); this.meterResponseDataRepository.save(meterResponseData); } this.notificationService.sendNotification(organisationIdentification, deviceIdentification, result, correlationUid, notificationMessage, notificationType); } catch (final Exception e) { this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, notificationType); } }

Target:
public void processMessage(final ObjectMessage message) throws JMSException { LOGGER.debug("Processing smart metering actual meter reads response message"); String correlationUid = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; String result = null; String notificationMessage = null; NotificationType notificationType = null; try { correlationUid = message.getJMSCorrelationID(); messageType = message.getJMSType(); organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION); deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION); result = message.getStringProperty(Constants.RESULT); notificationMessage = message.getStringProperty(Constants.DESCRIPTION); notificationType = NotificationType.valueOf(messageType); } 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 to handle response: {}", messageType); if (message.getObject() instanceof MeterReads) { final MeterReads data = (MeterReads) message.getObject(); final MeterResponseData meterResponseData = new MeterResponseData(organisationIdentification, messageType, deviceIdentification, correlationUid, data); this.meterResponseDataRepository.save(meterResponseData); } else { MeterReadsGas meterReadsGas = (MeterReadsGas) message.getObject(); final MeterResponseData meterResponseData = new MeterResponseData(organisationIdentification, messageType, deviceIdentification, correlationUid, meterReadsGas); this.meterResponseDataRepository.save(meterResponseData); } this.notificationService.sendNotification(organisationIdentification, deviceIdentification, result, correlationUid, notificationMessage, notificationType); } catch (final Exception e) { this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, notificationType); } }