List tunnels

Updated at:

Use Tablestore SDK for Java to list all tunnels of a table and obtain their types, stages, and configurations.

Prerequisites

Install Tablestore SDK for Java and initialize TunnelClient.

Feature description

Call listTunnel to list all tunnels of a table. The response does not include information about the channels in each tunnel. To obtain channel information, query the details of a specific tunnel.

ListTunnelResponse listTunnel(ListTunnelRequest request)
        throws TableStoreException, ClientException

The following example lists all tunnels of the example_table table and prints the name, type, stage, and creation time of each tunnel:

String tableName = "example_table";

ListTunnelRequest request = new ListTunnelRequest(tableName);
ListTunnelResponse response = tunnelClient.listTunnel(request);

for (TunnelInfo tunnelInfo : response.getTunnelInfos()) {
    System.out.printf(
            "name=%s, type=%s, stage=%s, createTime=%d%n",
            tunnelInfo.getTunnelName(),
            tunnelInfo.getTunnelType(),
            tunnelInfo.getStage(),
            tunnelInfo.getCreateTime());
}

Parameters

request is of the ListTunnelRequest type and contains the following parameter:

Name

Type

Description

tableName (required)

String

The name of the table.

Return values

The return value is of the ListTunnelResponse type and contains the following field:

Name

Type

Description

tunnelInfos

List<TunnelInfo>

The list of tunnels in the table. Call getTunnelInfos() to obtain this field.

Tunnel information

Each element in tunnelInfos[] is of the TunnelInfo type and contains the following fields:

Name

Type

Description

tunnelName

String

The name of the tunnel.

tunnelId

String

The ID of the tunnel.

tunnelType

TunnelType

The tunnel type. Valid values: BaseData, Stream, and BaseAndStream. The values indicate full data only, incremental data only, and full data followed by incremental data, respectively.

tableName

String

The name of the table.

instanceName

String

The name of the instance.

stage

TunnelStage

The tunnel stage. Valid values: InitBaseDataAndStreamShard, ProcessBaseData, and ProcessStream. The values indicate initialization, full data processing, and incremental data processing, respectively.

expired

boolean

Indicates whether the tunnel data is expired.

streamTunnelConfig

StreamTunnelConfig

The incremental data range configuration. If this parameter was not configured, the default configuration is returned. Tunnels of the BaseData type do not use this configuration. For information about the fields, see Create a tunnel.

createTime

long

The tunnel creation time. The value is a UNIX timestamp in milliseconds.

streamRecordOptions

StreamRecordOptions

The incremental record content configuration. If this parameter was not configured, the default configuration is returned. Tunnels of the BaseData type do not use this configuration. This field requires Tablestore SDK for Java 5.17.11 or later. For information about the fields, see Create a tunnel.