All Products
Search
Document Center

Tablestore:Query information about all tunnels of a data table

Last Updated:Jul 05, 2024

After you create a tunnel, you can call the ListTunnel operation to query information about all tunnels of a table, including the tunnel name, type, ID, and stage, and whether the data is expired.

Prerequisites

  • A TunnelClient instance is initialized.

  • A tunnel is created for the data table. For more information, see Create a tunnel.

Parameters

Request parameters

Parameter

Description

TableName

The name of the data table whose tunnel information you want to query.

Response parameters

Parameter

Description

List<TunnelInfo>

The information about the tunnels. The following information is included in the response:

  • TunnelId: the ID of the tunnel.

  • TunnelType: the type of the tunnel. Valid values: BaseData, Stream, and BaseAndStream. The BaseData type indicates that the tunnel is used to consume full data of the data table. The Stream type indicates that the tunnel is used to consume incremental data of the data table. The BaseAndStream type indicates that the tunnel is used to consume differential data of the data table.

  • TableName: the name of the data table for which the tunnel is created.

  • InstanceName: the name of the instance in which the tunnel is located.

  • Stage: the stage of the tunnel. Valid values: InitBaseDataAndStreamShard, ProcessBaseData, and ProcessStream. The InitBaseDataAndStreamShard stage indicates that the tunnel is being initialized. The ProcessBaseData stage indicates that the tunnel is being used to consume full data. The ProcessStream stage indicates that the tunnel is being used to consume incremental data.

  • Expired: indicates whether the data is expired.

    If true is returned, contact Tablestore technical support by using DingTalk at the earliest opportunity.

RequestId

The ID of the request.

Examples

The following sample code provides an example on how to query information about all tunnels of a table:

private static void listTunnel(TunnelClient client, String tableName) {
    ListTunnelRequest request = new ListTunnelRequest(tableName);
    ListTunnelResponse resp = client.listTunnel(request);
    System.out.println("RequestId: " + resp.getRequestId());
    for (TunnelInfo info : resp.getTunnelInfos()) {
        System.out.println("TunnelInfo::::::");
        System.out.println("\tTunnelName: " + info.getTunnelName());
        System.out.println("\tTunnelId: " + info.getTunnelId());
        // The type of the tunnel. Valid values: BaseData, Stream, and BaseAndStream. 
        System.out.println("\tTunnelType: " + info.getTunnelType());
        System.out.println("\tTableName: " + info.getTableName());
        System.out.println("\tInstanceName: " + info.getInstanceName());
        // The stage of the tunnel. Valid values: InitBaseDataAndStreamShard, ProcessBaseData, and ProcessStream. 
        System.out.println("\tStage: " + info.getStage());
        // Indicate whether the data is expired. If true is returned, contact Tablestore technical support by using DingTalk at the earliest opportunity. 
        System.out.println("\tExpired: " + info.isExpired());
    }
}

References

  • For information about the API operation that you can call to query information about all tunnels of a data table, see ListTunnel.

  • If you want to quickly use Tunnel Service to consume data, see Getting started.

  • You can query information about a tunnel. For more information, see Query information about a tunnel.

  • You can delete a tunnel that you no longer require. For more information, see Delete a tunnel.