protected virtual void Dispose(bool disposing) { this.disposing = disposing; if (!disposedValue) { if (disposing) { // TODO: dispose managed state (managed objects). if (consumer != null) { Logger.Debug("Disposing " + consumer.Name); consumer.Stop().Wait(); consumer.OnPartitionsAssigned -= Consumer_OnPartitionsAssigned; consumer.OnPartitionsRevoked -= Consumer_OnPartitionsRevoked; consumer.OnEndReached -= Consumer_OnEndReached; consumer.Dispose(); } consumer = null; } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. disposedValue = true; } }
public static void Stop() { consumer.Stop(); }