Skip to content

CxODEV-2125: keep the Kafka cancellation consumer running after a bad message (3.10.1 backport) - #230

Closed
milansvitlica-codaxy wants to merge 1 commit into
v3from
CxODEV-2125-kafka-notifier-skip-bad-messages-v3
Closed

milansvitlica-codaxy wants to merge 1 commit into
v3from
CxODEV-2125-kafka-notifier-skip-bad-messages-v3

Conversation

@milansvitlica-codaxy

Copy link
Copy Markdown
Collaborator

Backport of #229 to v3.

Same change: the Kafka cancellation consumer now logs and skips a message that fails, instead of stopping for good. See #229 for the problem, the fix and the tests.

  • Packages 3.10.0 → 3.10.1. ConductorSharp.Toolkit stays at 3.0.1-beta3, as on v3.
  • The cherry-pick applied cleanly apart from the version lines.

Tests

Full suite on this branch, dotnet test ConductorSharp.sln: 73 passed, 0 failed, including the three new KafkaCancellationNotifierTests. Run locally in an LF checkout on the .NET 8 runtime (DOTNET_ROLL_FORWARD=Major).

CI does not run for pull requests to v3 (dotnet.yml triggers on master only), so the local run above is the check for this branch.

🤖 Generated with Claude Code

…0.1 backport)

The consume loop sat inside a single try/catch. When one message failed,
the catch logged "will retry to consume after 5 seconds", waited, and then
ExecuteAsync returned. The consumer never restarted, so the worker kept
running but stopped cancelling tasks until the process restarted.

Two kinds of message trigger it:
- the handler throws, e.g. a status event with "workflowTask": null
  (NullReferenceException on WorkflowTask.Type);
- the value fails to deserialize (invalid or empty JSON, an unknown
  status, a workflowTask without name or taskReferenceName), so Consume
  throws a ConsumeException.

Errors are now caught per message: logged, and the loop moves on to the
next message. OperationCanceledException from the stopping token still
ends the loop, so shutdown is unchanged. The 5-second pause is gone. It
only ran once before the loop exited, and pausing on every bad message
would hold up every cancellation behind it.

Tests run the real consumer against librdkafka's in-process mock cluster
(test.mock.num.brokers), so they need no broker or Docker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@milansvitlica-codaxy

Copy link
Copy Markdown
Collaborator Author

Closing without merging: not pursuing this change for now.

@milansvitlica-codaxy
milansvitlica-codaxy deleted the CxODEV-2125-kafka-notifier-skip-bad-messages-v3 branch October 9, 2026 08:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant