Skip to content

Fix #365: Remove unnecessary ForageConnectionFactory wrapper#375

Open
JiriOndrusek wants to merge 1 commit into
KaotoIO:mainfrom
JiriOndrusek:365-remove-unnecessary-wrapper
Open

Fix #365: Remove unnecessary ForageConnectionFactory wrapper#375
JiriOndrusek wants to merge 1 commit into
KaotoIO:mainfrom
JiriOndrusek:365-remove-unnecessary-wrapper

Conversation

@JiriOndrusek

@JiriOndrusek JiriOndrusek commented May 28, 2026

Copy link
Copy Markdown
Contributor

fixes #365

The ForageConnectionFactory wrapper was unnecessary. It was a simple record that wrapped ConnectionFactory, which was immediately unwrapped at every usage point.

Summary by CodeRabbit

  • Refactor
    • Simplified JMS connection handling by removing an internal wrapper layer. The system now registers JMS connection factories directly, reducing unnecessary abstraction complexity while maintaining compatibility.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@JiriOndrusek, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 39 minutes and 28 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a35abc5d-701f-4e3d-975c-550355dd8561

📥 Commits

Reviewing files that changed from the base of the PR and between efdd270 and d4b90c2.

📒 Files selected for processing (2)
  • library/jms/forage-jms-common/src/main/java/io/kaoto/forage/jms/common/ForageConnectionFactory.java
  • library/jms/forage-jms/src/main/java/io/kaoto/forage/jms/ConnectionFactoryBeanFactory.java
📝 Walkthrough

Walkthrough

This PR removes the ForageConnectionFactory wrapper record and refactors ConnectionFactoryBeanFactory to bind raw JMS ConnectionFactory instances directly. The wrapper was immediately unwrapped in bindings, making it redundant.

Changes

Wrapper Abstraction Removal

Layer / File(s) Summary
Remove ForageConnectionFactory wrapper and update factory bindings
library/jms/forage-jms/src/main/java/io/kaoto/forage/jms/ConnectionFactoryBeanFactory.java
ForageConnectionFactory import is removed. Named and default bindings now directly create and bind raw ConnectionFactory instead of wrapping. Private method return types change from ForageConnectionFactory to ConnectionFactory, and doCreateConnectionFactory delegates directly to the provider without wrapping.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A wrapper unwrapped, away it goes,
No more layers in the factory flows!
Raw ConnectionFactory now takes the stage,
Simpler code turns the page. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: removing the ForageConnectionFactory wrapper, which is the core objective of the PR.
Linked Issues check ✅ Passed The PR successfully addresses #365 by removing the ForageConnectionFactory wrapper and its unnecessary wrapping/unwrapping cycle as requested.
Out of Scope Changes check ✅ Passed All changes are directly related to removing the ForageConnectionFactory wrapper; no out-of-scope modifications are present.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@library/jms/forage-jms/src/main/java/io/kaoto/forage/jms/ConnectionFactoryBeanFactory.java`:
- Around line 132-133: The code in ConnectionFactoryBeanFactory calls
newConnectionFactory(cfConfig, name) and immediately passes the result to
camelContext.getRegistry().bind(...) without checking for null; update both
places where newConnectionFactory(...) is used so you first capture the return
in a local variable (e.g., connectionFactory), check if it is null, and only
call camelContext.getRegistry().bind(name, connectionFactory) when non-null —
otherwise either log/warn and skip registration or throw a clear exception
(choose consistent behavior used elsewhere in ConnectionFactoryBeanFactory) to
avoid a runtime NPE when no provider is found.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 390d5547-3fbc-42fd-9834-8c01c8bcab23

📥 Commits

Reviewing files that changed from the base of the PR and between 44cb9c7 and efdd270.

📒 Files selected for processing (2)
  • library/jms/forage-jms-common/src/main/java/io/kaoto/forage/jms/common/ForageConnectionFactory.java
  • library/jms/forage-jms/src/main/java/io/kaoto/forage/jms/ConnectionFactoryBeanFactory.java
💤 Files with no reviewable changes (1)
  • library/jms/forage-jms-common/src/main/java/io/kaoto/forage/jms/common/ForageConnectionFactory.java

The ForageConnectionFactory wrapper was serving as unnecessary indirection
in the JMS module. It was a simple record that wrapped ConnectionFactory,
which was immediately unwrapped at every usage point.
@JiriOndrusek JiriOndrusek force-pushed the 365-remove-unnecessary-wrapper branch from efdd270 to d4b90c2 Compare May 28, 2026 13:12
@JiriOndrusek JiriOndrusek requested review from Croway and orpiske June 4, 2026 11:36
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.

Investigate whether ForageConnectionFactory wrapper is needed in JMS module

3 participants