Skip to content

fix: keep the NATS task subscriber consuming after errors - #6117

Merged
wolf4ood merged 1 commit into
eclipse-edc:mainfrom
wolf4ood:fix/6116_nats_subscriber_resilience
Oct 16, 2026
Merged

wolf4ood merged 1 commit into
eclipse-edc:mainfrom
wolf4ood:fix/6116_nats_subscriber_resilience

Conversation

@wolf4ood

Copy link
Copy Markdown
Contributor

What this PR changes/adds

NatsSubscriber:

  • Fetch errors. An exception while fetching messages (e.g. a NATS disconnect) is logged and the subscriber tries
    again after a pause (1 s by default). Before, it ended the consumer loop silently: the subscriber stopped consuming
    for good, with nothing in the logs.
  • Ack/nak errors. An exception from nak() while handling a failed message is logged, and the other messages
    of the batch are still handled.
  • Stopping. Errors after stop() (e.g. from the closed connection) end the loop quietly.
  • Unrecoverable errors (Error) are logged before the loop ends.
  • isHealthy(). The subscriber is healthy until it is started; after that, while its loop is running and its
    connection is not closed for good (jnats gave up reconnecting).

NatsTransferProcessTaskSubscriberExtension and NatsContractNegotiationSubscriberExtension register a liveness check
that reports the subscriber as not live when it is no longer consuming messages, so that the runtime can be
restarted.

Why it does that

A subscriber whose loop had stopped left every new task unprocessed, while the runtime looked healthy.

Further notes

  • New NatsSubscriberTest. Without the fix, the tests for a failing fetch, a failing nak() and an Error in the
    handler fail.
  • The extension tests check that the liveness providers are registered.
  • How handler failures map to ack/nak/term is unchanged. Retrying them with a delay is the next item of the issue.

Who will sponsor this feature?

Please @-mention the committer that will sponsor your feature.

Linked Issue(s)

Part of #6116

Please be sure to take a look at the contributing guidelines and our etiquette for pull requests.

@wolf4ood wolf4ood added the enhancement New feature or request label Oct 16, 2026
@wolf4ood wolf4ood self-assigned this Oct 16, 2026
@wolf4ood
wolf4ood marked this pull request as ready for review October 16, 2026 16:30
@wolf4ood
wolf4ood requested a review from a team as a code owner October 16, 2026 16:30
@wolf4ood
wolf4ood merged commit 6bb16fc into eclipse-edc:main Oct 16, 2026
23 of 24 checks passed
@wolf4ood
wolf4ood deleted the fix/6116_nats_subscriber_resilience branch October 16, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants