fix: remove spurious routing dependency from JooqDslContextMiddleware - #176
Merged
Conversation
The routing dependency was copied from JooqTransactionMiddleware but is not needed here — the middleware only stores a DSLContext in the request extensions. Removing it allows the middleware to be used in FaaS environments where RoutingMiddleware is absent. closes #171
…eated failures The previous design used a single monitor thread (ZThread.start) that handled both phase 1 (connection attempt) and phase 2 (disconnect detection after successful connect). The thread called ZEvent.recv() in blocking mode; closing the monitor socket from connect() did not unblock the recv(), so the thread outlived each failed attempt and accumulated across retries. Root cause: jeromq PAIR/inproc sockets do not unblock a blocking recv() when the peer socket is closed, so the monitor thread never exited on the failure path, and ctx.close() in handler.close() was needed to finally terminate it — causing the ZMQException(ETERM) noise in the CI log and making repeated connect() calls unreliable under timing pressure. Fix: split the two phases. - Phase 1 (connection attempt): removed the monitor entirely. The existing CONNECT_TIMEOUT_MS poller loop already handles the failure case correctly. - Phase 2 (disconnect detection): start a dedicated monitor thread *after* the completer handshake succeeds, monitoring only DISCONNECTED/CLOSED events on the confirmed connection. Each monitor thread now has a clean lifecycle: it starts only on success and exits either on DISCONNECTED (calls close()) or on ETERM (ctx.close()). No shared monitor socket ownership races remain.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dependencies = {"routing"}from@MiddlewareonJooqDslContextMiddlewarehandle()method has no dependency on routing — it only stores aDSLContextin request extensionsJooqTransactionMiddleware, which genuinely needs routingImpact
Allows
JooqDslContextMiddlewareto be used in FaaS environments (e.g. AWS Lambda via enkan-faas) whereRoutingMiddlewareis absent. The spurious dependency caused the middleware stack validator to reject a valid configuration.Test plan
mvn test -pl enkan-component-jooq -ampassescloses #171