protected void response(PullMessageTask pullTask, List<TppConsumerMessageBatch> batches) {
    PullMessageResultCommand cmd = new PullMessageResultCommand();
    if (batches != null) {
      cmd.addBatches(batches);
    }
    cmd.getHeader().setCorrelationId(pullTask.getCorrelationId());

    pullTask.getChannel().writeAndFlush(cmd);
  }
  protected void response(
      PullMessageTask pullTask, List<TppConsumerMessageBatch> batches, Offset offset) {
    Command cmd = null;
    switch (pullTask.getPullMessageCommandVersion()) {
      case 1:
        cmd = new PullMessageResultCommand();
        if (batches != null) {
          ((PullMessageResultCommand) cmd).addBatches(batches);
        }
        break;
      case 2:
      default:
        cmd = new PullMessageResultCommandV2();
        if (batches != null) {
          ((PullMessageResultCommandV2) cmd).addBatches(batches);
        }
        ((PullMessageResultCommandV2) cmd).setOffset(offset);
        break;
    }
    cmd.getHeader().setCorrelationId(pullTask.getCorrelationId());

    pullTask.getChannel().writeAndFlush(cmd);
  }