public void Ack(long batchId) { WaitClientRunning(); if (!_running) { return; } var ca = new ClientAck() { Destination = _clientIdentity.Destination, ClientId = _clientIdentity.ClientId.ToString(), BatchId = batchId }; var pack = new Packet() { Type = PacketType.Clientack, Body = ca.ToByteString() }.ToByteArray(); try { WriteWithHeader(pack); } catch (IOException e) { throw new CanalClientException(e.Message, e); } }
/// <summary> /// Ack has received data. /// </summary> /// <param name="batchId"></param> /// <returns></returns> public async Task AckAsync(long batchId) { ValidateState(ConnectionState.Subscribed, nameof(AckAsync)); var ca = new ClientAck() { Destination = _options.Destination, ClientId = _options.ClientId, BatchId = batchId }; var pack = new Packet() { Type = PacketType.Clientack, Body = ca.ToByteString() }.ToByteArray(); await _client.WritePacketAsync(pack); _logger.LogDebug($"Ack {batchId} success."); }