After you create a tunnel, you can call the DescribeTunnel operation to query information about the tunnel, such as information about channels in the tunnel.
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. |
TunnelName | The name of the tunnel. |
Response parameters
Parameter | Description |
TunnelConsumePoint | The most recent time when the tunnel is used to consume incremental data. The time is the point in time when the slowest channel in the tunnel is used to consume data. Default value: January 1, 1970 (UTC). |
TunnelInfo | The information about the tunnel. The following information is included in the response:
|
List<ChannelInfo> | The information about the channels in the tunnel. The following information is included in the response:
|
RequestId | The ID of the request. |
Examples
The following sample code provides an example on how to query information about a tunnel, including the most recent time when the tunnel is used to consume incremental data and the information about the channels in the tunnel:
// The most recent time when the tunnel is used to consume incremental data and the recovery point objective (RPO) take effect only if the tunnel is of the Stream type.
// Stream tunnel: The Stage parameter in TunnelInfo is ProcessStream. Stream channel: The ChannelType parameter in ChannelInfo is Stream.
private static void describeTunnel(TunnelClient client, String tableName, String tunnelName) {
DescribeTunnelRequest request = new DescribeTunnelRequest(tableName, tunnelName);
DescribeTunnelResponse resp = client.describeTunnel(request);
System.out.println("RequestId: " + resp.getRequestId());
// The most recent time when the tunnel is used to consume incremental data. The time is the point in time when the slowest channel in the tunnel is used to consume data. Default value: January 1, 1970 (UTC).
System.out.println("TunnelConsumePoint: " + resp.getTunnelConsumePoint());
System.out.println("TunnelInfo: " + resp.getTunnelInfo());
for (ChannelInfo ci : resp.getChannelInfos()) {
System.out.println("ChannelInfo::::::");
System.out.println("\tChannelId: " + ci.getChannelId());
// The type of the channel. Valid values: BaseData and Stream.
System.out.println("\tChannelType: " + ci.getChannelType());
// The ID of the tunnel client. By default, the client ID concatenates the hostname of the client and a random string.
System.out.println("\tClientId: " + ci.getClientId());
// The most recent time when the channel is used to consume incremental data.
System.out.println("\tChannelConsumePoint: " + ci.getChannelConsumePoint());
// The number of data entries that the channel synchronizes.
System.out.println("\tChannelCount: " + ci.getChannelCount());
}
}
References
For information about the API operation that you can call to query information about a tunnel, see DescribeTunnel.
If you want to quickly use Tunnel Service to consume data, see Getting started.
You can query information about all tunnels of a table. For more information, see Query information about all tunnels of a data table.
You can delete a tunnel that you no longer require. For more information, see Delete a tunnel.