コード例 #1
0
        public void Rollback(long batchId)
        {
            WaitClientRunning();

            var ca = new ClientRollback()
            {
                Destination = _clientIdentity.Destination,
                ClientId    = _clientIdentity.ClientId.ToString(),
                BatchId     = batchId
            };

            try
            {
                var pack = new Packet()
                {
                    Type = PacketType.Clientrollback,
                    Body = ca.ToByteString()
                }.ToByteArray();

                WriteWithHeader(pack);
            }
            catch (IOException e)
            {
                throw new CanalClientException(e.Message, e);
            }
        }
コード例 #2
0
        /// <summary>
        /// Roll back consumption progress
        /// </summary>
        /// <param name="batchId"></param>
        /// <returns></returns>
        public async Task RollbackAsync(long batchId)
        {
            ValidateState(ConnectionState.Subscribed, nameof(RollbackAsync));

            var ca = new ClientRollback()
            {
                Destination = _options.Destination,
                ClientId    = _options.ClientId,
                BatchId     = batchId
            };

            var pack = new Packet()
            {
                Type = PacketType.Clientrollback,
                Body = ca.ToByteString()
            }.ToByteArray();

            await _client.WritePacketAsync(pack);

            _logger.LogDebug($"Rollback {batchId} success.");
        }