@Override
  protected void handleError(
      final Exception e,
      final DeviceMessageMetadata deviceMessageMetadata,
      final ResponseMessage responseMessage)
      throws FunctionalException {

    final OsgpException osgpException = this.ensureOsgpException(e);

    final BundleMessagesRequestDto bundleMessagesResponseDto =
        (BundleMessagesRequestDto) responseMessage.getDataObject();

    final List<ActionDto> actionList = bundleMessagesResponseDto.getActionList();
    for (final ActionDto action : actionList) {
      if (action.getResponse() == null) {
        action.setResponse(
            new ActionResponseDto(OsgpResultTypeDto.NOT_OK, e, "Unable to handle request"));
      }
    }

    this.bundleService.handleBundleResponse(
        deviceMessageMetadata,
        responseMessage.getResult(),
        osgpException,
        bundleMessagesResponseDto);
  }
  @Override
  public void processMessage(final ObjectMessage message) throws JMSException {
    LOGGER.debug("Processing admin revoke key 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);

      this.deviceManagementService.handleRevokeKeyResponse(
          organisationIdentification,
          deviceIdentification,
          correlationUid,
          messageType,
          responseMessageResultType,
          osgpException);

    } catch (final Exception e) {
      this.handleError(
          e, correlationUid, organisationIdentification, deviceIdentification, messageType);
    }
  }
  @Override
  protected void handleMessage(
      final DeviceMessageMetadata deviceMessageMetadata,
      final ResponseMessage responseMessage,
      final OsgpException osgpException)
      throws FunctionalException {

    final BundleMessagesRequestDto bundleMessagesResponseDto =
        (BundleMessagesRequestDto) responseMessage.getDataObject();

    this.bundleService.handleBundleResponse(
        deviceMessageMetadata,
        responseMessage.getResult(),
        osgpException,
        bundleMessagesResponseDto);
  }
 @Override
 protected boolean hasRegularResponseObject(final ResponseMessage responseMessage) {
   return responseMessage.getDataObject() instanceof BundleMessagesRequestDto;
 }