To simplify the complexity of using the SDK, Data Transmission Service (DTS) implements the SDK disaster tolerance mechanism. The mechanism relies on the real-time reporting of consumption time to the DTS central control node when the SDK consumes data. This section introduces how to use the SDK disaster tolerance mechanism provided by DTS.

  1. In the code for consuming messages in the SDK, each consumption of a message calls the ackAsConsumed API to report the consumption time to DTS.
  2. A subscription channel requires you to start at least a primary SDK and a secondary SDK.

Consumption architecture

Enter the connection type

In a subscription channel of DTS, only one SDK can pull incremental data. If multiple downstream SDKs exist in a subscription channel, only one of them can receive incremental data. Therefore, the SDK disaster tolerance architecture can be set up.

In the sample architecture in the preceding figure, two downstream SDKs are connected in one subscription channel. The two SDKs serve as a primary and secondary SDK for each other. Within the same period of time, only the primary SDK can subscribe to and consume the incremental data. In case of primary SDK exceptions or network connection exceptions, DTS initiates automatic failover to the secondary SDK and starts the secondary SDK using the last consumption time. Every time the primary SDK consumes a message, it reports an ACK message to the DTS control system, which means it reports the consumption time to the control system.