public static PipeSubscribeHandshakeResp toTPipeSubscribeResp(
      final TSStatus status,
      final int dataNodeId,
      final String consumerId,
      final String consumerGroupId) {
    final PipeSubscribeHandshakeResp resp = new PipeSubscribeHandshakeResp();

    resp.dataNodeId = dataNodeId;
    resp.consumerId = consumerId;
    resp.consumerGroupId = consumerGroupId;

    resp.status = status;
    resp.version = PipeSubscribeResponseVersion.VERSION_1.getVersion();
    resp.type = PipeSubscribeResponseType.ACK.getType();

    try (final PublicBAOS byteArrayOutputStream = new PublicBAOS();
        final DataOutputStream outputStream = new DataOutputStream(byteArrayOutputStream)) {
      ReadWriteIOUtils.write(dataNodeId, outputStream);
      ReadWriteIOUtils.write(consumerId, outputStream);
      ReadWriteIOUtils.write(consumerGroupId, outputStream);
      resp.body =
          Collections.singletonList(
              ByteBuffer.wrap(byteArrayOutputStream.getBuf(), 0, byteArrayOutputStream.size()));
    } catch (final IOException e) {
      resp.status = RpcUtils.getStatus(TSStatusCode.SUBSCRIPTION_HANDSHAKE_ERROR, e.getMessage());
      return resp;
    }

    return resp;
  }
Serialize the incoming parameters into `PipeSubscribeHandshakeResp`, called by the subscription
server.
iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/subscription/payload/response/PipeSubscribeHandshakeResp.java