Repository navigation
refactor: improve dependency injection and error handling in async producer managers - #2071
Merged
Merged
Conversation
…ng in async producer managers Address SonarQube maintainability and reliability issues across ProducerManager, KafkaProducerManager and WebSocketProducerManager. Critical: - Extract triggerBindingMockMessage helper to reduce cognitive complexity (S3776) Major: - Replace field injection with constructor injection (S6813) - Introduce ProducerDependencies to limit constructor parameters (S107) - Guard Optional#get() with isPresent() in renderEventMessageHeaders (S3655) - Replace Throwable with Exception in message rendering methods (S1181) - Return Collections.emptySet() instead of null (S1168) Minor: - Remove unnecessary braces in lambda expressions (S1126) - Replace unused exception variable with '_' (S6910) Behaviour is unchanged. Signed-off-by: kishore08-07 <[email protected]>
lbroudoux
approved these changes
May 4, 2026
lbroudoux
left a comment
Member
There was a problem hiding this comment.
Thanks for this refactoring. This looks all good to me!
Signed-off-by: Laurent Broudoux <[email protected]>
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.
Description
This PR addresses 13 SonarQube maintainability and reliability violations across three classes in
minions/async/src/main/java/io/github/microcks/minion/async/producer/.@Injectfield injections with constructor injectiontriggerAsyncMockMessagesby extracting the inner binding dispatch into a private helper methodThrowablecatches withException, and returns an emptycollection instead of null.
ProducerDependenciesholder class is introduced to keep theProducerManagerconstructor within the 7-parameter limit while preserving backward compatibility for existing tests via a suppressed 9-parameter constructor.mvn spotless:check -pl minions/async.Related issue(s)
See also #2058