Skip to content

Commit

Permalink
fix: prevent Kafka auto-recovery while disconnecting
Browse files Browse the repository at this point in the history
  • Loading branch information
BEagle1984 committed Aug 8, 2023
1 parent 238f022 commit a30458a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ private bool ConsumeOnce(CancellationToken cancellationToken)
}
catch (Exception ex)
{
AutoRecoveryIfEnabled(ex);
if (_consumer is { IsConnected: true, IsDisconnecting: false })
AutoRecoveryIfEnabled(ex);

return false;
}

Expand Down
8 changes: 4 additions & 4 deletions src/Silverback.Integration/Messaging/Broker/Consumer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ protected Consumer(
public bool IsConsuming { get; protected set; }

/// <summary>
/// Gets the <see cref="IServiceProvider" /> to be used to resolve the required services.
/// Gets a value indicating whether the consumer is being disconnected.
/// </summary>
protected IServiceProvider ServiceProvider { get; }
public bool IsDisconnecting { get; private set; }

/// <summary>
/// Gets a value indicating whether the consumer is being disconnected.
/// Gets the <see cref="IServiceProvider" /> to be used to resolve the required services.
/// </summary>
protected bool IsDisconnecting { get; private set; }
protected IServiceProvider ServiceProvider { get; }

/// <summary>
/// Gets a value indicating whether the consumer is being stopped.
Expand Down

0 comments on commit a30458a

Please sign in to comment.