Query tunnel information
Use Tablestore SDK for Java to query the configuration, stage, channel states, and incremental consumption progress of a tunnel.
Prerequisites
Install Tablestore SDK for Java and initialize TunnelClient.
Feature description
Call describeTunnel to query information about a tunnel. The response includes the tunnel configuration, overall incremental consumption point and recovery point objective (RPO), and the state and consumption progress of each channel in the tunnel.
DescribeTunnelResponse describeTunnel(DescribeTunnelRequest request)
throws TableStoreException, ClientException
The following example queries information about the example_tunnel tunnel of the example_table table and prints the tunnel stage and the state and consumption progress of each channel:
String tableName = "example_table";
String tunnelName = "example_tunnel";
DescribeTunnelRequest request =
new DescribeTunnelRequest(tableName, tunnelName);
DescribeTunnelResponse response = tunnelClient.describeTunnel(request);
TunnelInfo tunnelInfo = response.getTunnelInfo();
System.out.printf(
"name=%s, type=%s, stage=%s%n",
tunnelInfo.getTunnelName(),
tunnelInfo.getTunnelType(),
tunnelInfo.getStage());
for (ChannelInfo channelInfo : response.getChannelInfos()) {
System.out.printf(
"channelId=%s, type=%s, status=%s, count=%d%n",
channelInfo.getChannelId(),
channelInfo.getChannelType(),
channelInfo.getChannelStatus(),
channelInfo.getChannelCount());
}
Parameters
request is of the DescribeTunnelRequest type and contains the following parameters:
|
Name |
Type |
Description |
|
tableName (required) |
|
The name of the table. |
|
tunnelName (required) |
|
The name of the tunnel. |
Return values
The return value is of the DescribeTunnelResponse type and contains the following fields:
|
Name |
Type |
Description |
|
tunnelConsumePoint |
|
The latest incremental consumption point of the tunnel. The value is the consumption point of the slowest channel in the tunnel. Default value: 00:00:00 on January 1, 1970 (UTC). Call |
|
tunnelRpo |
|
The incremental consumption RPO of the tunnel, which is the difference between the current time and the consumption point of the slowest channel. Unit: milliseconds. Call |
|
tunnelInfo |
|
The tunnel information. Call |
|
channelInfos |
|
The list of channels in the tunnel. If the tunnel has not initialized any channels, an empty list is returned. Call |
tunnelConsumePoint and tunnelRpo apply only to incremental consumption. If incremental consumption has not started or the tunnel consumes only full data, tunnelConsumePoint is the default value. In this case, do not use tunnelRpo to determine the consumption latency.
Channel information
Each element in channelInfos[] is of the ChannelInfo type and contains the following fields:
|
Name |
Type |
Description |
|
channelId |
|
The channel ID. |
|
channelType |
|
The channel type. Valid values: |
|
channelStatus |
|
The channel state. Valid values: |
|
clientId |
|
The ID of the client that consumes the channel. This field may be empty if no client is assigned to the channel. The client ID is generated based on |
|
channelConsumePoint |
|
The latest incremental consumption point of the channel. Default value: 00:00:00 on January 1, 1970 (UTC). This field does not apply to full-data channels. |
|
channelRpo |
|
The incremental consumption RPO of the channel, which is the difference between the current time and |
|
channelCount |
|
The number of rows synchronized by the channel. |