private void ErrorCallback(IntPtr rk, ErrorCode err, string reason, IntPtr opaque) { // Ensure registered handlers are never called as a side-effect of Dispose/Finalize (prevents deadlocks in common scenarios). if (ownedKafkaHandle.IsClosed) { return; } errorHandler?.Invoke(KafkaHandle.CreatePossiblyFatalError(err, reason)); }
private void ErrorCallback(IntPtr rk, ErrorCode err, string reason, IntPtr opaque) { if (kafkaHandle.IsClosed) { return; } try { // Ensure registered handlers are never called as a side-effect of Dispose/Finalize (prevents deadlocks in common scenarios). errorHandler?.Invoke(kafkaHandle.CreatePossiblyFatalError(err, reason)); } catch (Exception) { // Eat any exception thrown by user error handler code. Although these could be // exposed to the application via the initiating function call easily enough, // they aren't for consistency with the producer (where the poll method is called) // on a background thread. } }