Source:
<code>public void processMessage(final ObjectMessage message) throws JMSException { LOGGER.debug("Processing smart metering default response message"); String correlationUid = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; ResponseMessage responseMessage = null; ResponseMessageResultType responseMessageResultType = null; OsgpException osgpException = null; try { correlationUid = message.getJMSCorrelationID(); messageType = message.getJMSType(); organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION); deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION); responseMessage = (ResponseMessage) message.getObject(); responseMessageResultType = responseMessage.getResult(); osgpException = responseMessage.getOsgpException(); } 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); LOGGER.debug("responseMessageResultType: {}", responseMessageResultType); LOGGER.debug("deviceIdentification: {}", deviceIdentification); LOGGER.debug("osgpException: {}", osgpException); return; } try { LOGGER.info("Calling application service function to handle response: {}", messageType); <START> if (responseMessage.getDataObject() instanceof ActualMeterReads) { <END> final ActualMeterReads actualMeterReadsDto = (ActualMeterReads) responseMessage.getDataObject(); this.monitoringService.handleActualMeterReadsResponse(deviceIdentification, organisationIdentification, correlationUid, messageType, responseMessageResultType, osgpException, actualMeterReadsDto); } else { MeterReadsGas meterReadsGas = (MeterReadsGas) responseMessage.getDataObject(); this.monitoringService.handleActualMeterReadsResponse(deviceIdentification, organisationIdentification, correlationUid, messageType, responseMessageResultType, osgpException, meterReadsGas); } } catch (final Exception e) { this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, messageType); } }</code><technical_language>Special casing this if ActualMeterReadsResponseMessageProcessor responsibilities</technical_language>

Target:
public void processMessage(final ObjectMessage message) throws JMSException { LOGGER.debug("Processing smart metering default response message"); String correlationUid = null; String messageType = null; String organisationIdentification = null; String deviceIdentification = null; ResponseMessage responseMessage = null; ResponseMessageResultType responseMessageResultType = null; OsgpException osgpException = null; try { correlationUid = message.getJMSCorrelationID(); messageType = message.getJMSType(); organisationIdentification = message.getStringProperty(Constants.ORGANISATION_IDENTIFICATION); deviceIdentification = message.getStringProperty(Constants.DEVICE_IDENTIFICATION); responseMessage = (ResponseMessage) message.getObject(); responseMessageResultType = responseMessage.getResult(); osgpException = responseMessage.getOsgpException(); } 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); LOGGER.debug("responseMessageResultType: {}", responseMessageResultType); LOGGER.debug("deviceIdentification: {}", deviceIdentification); LOGGER.debug("osgpException: {}", osgpException); return; } try { LOGGER.info("Calling application service function to handle response: {}", messageType); if (responseMessage.getDataObject() instanceof MeterReads) { final MeterReads actualMeterReadsDto = (MeterReads) responseMessage.getDataObject(); this.monitoringService.handleActualMeterReadsResponse(deviceIdentification, organisationIdentification, correlationUid, messageType, responseMessageResultType, osgpException, actualMeterReadsDto); } else { MeterReadsGas meterReadsGas = (MeterReadsGas) responseMessage.getDataObject(); this.monitoringService.handleActualMeterReadsResponse(deviceIdentification, organisationIdentification, correlationUid, messageType, responseMessageResultType, osgpException, meterReadsGas); } } catch (final Exception e) { this.handleError(e, correlationUid, organisationIdentification, deviceIdentification, messageType); } }