You can call the CreateTunnel operation to create one or more tunnels for a table. When you create a tunnel, you must specify the table name, tunnel name, and tunnel type.

Request parameters

Parameter Description
TableName The name of the table for which you wan to create a tunnel.
TunnelName The tunnel name.
TunnelType The type of the tunnel. Valid values: BaseData, Stream, and BaseAndStream.

Response parameters

Parameter Description
TunnelId The channel ID.
ResponseInfo Some other fields returned in the request.
RequestId The ID of the request.

Examples

// 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());
}