You can call this operation to create one or more tunnels for a specified table. Specify the table name, tunnel name, and tunnel type when creating the tunnel.

Request parameters

  • TableName: the name of the table that you want to create tunnels for.
  • TunnelName: the name of the tunnel that you want to create.
  • TunnelType: the type of the tunnel that you want to create. Valid values: BaseData, Stream, and BaseAndStream.

Response parameters

  • TunnelId: the ID of the tunnel that you want to create.
  • ResponseInfo: some other fields returned in the request.

    RequestId: the GUID generated by Alibaba Cloud for the request.


// You can create three types of tunnels: TunnelType.BaseData, TunnelType.Stream, and TunnelType.BaseAndStream.
// The following example shows how to create a BaseData tunnel. To create other types of tunnels, set TunnelType in CreateTunnelRequest to the required type.
private static void createTunnel(TunnelClient client, String tunnelName) {
    CreateTunnelRequest request = new CreateTunnelRequest(TableName, tunnelName, TunnelType.BaseData);
    CreateTunnelResponse resp = client.createTunnel(request);
    System.out.println("RequestId: " + resp.getRequestId());
    System.out.println("TunnelId: " + resp.getTunnelId());