/**
   * Method to communicate with the backend via JMS.
   *
   * @param command The {@link Command} object to be executed.
   * @return The result of the {@link Command} object execution.
   */
  private <T> T executeJmsCommand(Command command) {

    Queue sendQueue;
    boolean isTaskCommand = (command instanceof TaskCommand);
    if (isTaskCommand) {
      sendQueue = config.getTaskQueue();
      if (!config.getUseUssl() && !config.getDisableTaskSecurity()) {
        throw new RemoteCommunicationException(
            "Task operation requests can only be sent via JMS if SSL is used.");
      }
    } else {
      sendQueue = config.getKsessionQueue();
    }

    return internalExecuteJmsCommand(
        command,
        config.getConnectionUserName(),
        config.getConnectionPassword(),
        config.getUserName(),
        config.getPassword(),
        config.getDeploymentId(),
        config.getProcessInstanceId(),
        config.getCorrelationProperties(),
        config.getConnectionFactory(),
        sendQueue,
        config.getResponseQueue(),
        (SerializationProvider) config.getJaxbSerializationProvider(),
        config.getExtraJaxbClasses(),
        config.getSerializationType(),
        config.getTimeout());
  }