internal void Connect() { if (_innerConsumer != null) { return; } _innerConsumer = new InnerConsumerWrapper( Endpoint.Configuration.ConfluentConfig, Endpoint.Configuration.EnableAutoRecovery, _logger); _innerConsumer.Subscribe(Endpoint); _innerConsumer.Received += OnMessageReceived; _innerConsumer.StartConsuming(); _logger.LogTrace("Connected consumer to topic {topic}. (BootstrapServers=\"{bootstrapServers}\")", Endpoint.Name, Endpoint.Configuration.BootstrapServers); }
internal void Disconnect() { if (_innerConsumer == null) { return; } _innerConsumer.StopConsuming(); if (!Endpoint.Configuration.IsAutoCommitEnabled) { _innerConsumer.CommitAll(); } _innerConsumer.Dispose(); _innerConsumer = null; _logger.LogTrace("Disconnected consumer from topic {topic}. (BootstrapServers=\"{bootstrapServers}\")", Endpoint.Name, Endpoint.Configuration.BootstrapServers); }