Skip to content

[backport camel-4.22.x] CAMEL-25918: camel-as2 - consumers sharing a port use their own asynchronous MDN settings - #28347

Open
gnodet wants to merge 1 commit into
camel-4.22.xfrom
backport/28274-to-camel-4.22.x
Open

gnodet wants to merge 1 commit into
camel-4.22.xfrom
backport/28274-to-camel-4.22.x

Conversation

@gnodet

@gnodet gnodet commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Backport of #28274

Cherry-pick of cb73720 to camel-4.22.x.
Conflicts resolved automatically by backport bot agent.

…port use their own asynchronous MDN settings
@gnodet gnodet added the backport indicate that a Pull request is a backport from a fix from the main branch label Oct 23, 2026

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The backport cherry-picked the AS2ServerConnection call site that passes sslContext to a 10-arg AS2AsynchronousMDNManager constructor — but that constructor only exists on main. On camel-4.22.x the class has only 8-arg (deprecated) and 9-arg constructors, neither of which accepts an SSLContext. This is a compilation error.

The core logic of the fix — moving MDN settings from AS2ServerConnection fields into AS2ConsumerConfiguration and looking them up per-request — is correct and well-structured. The integration test (AS2ServerTwoConsumerAsyncMdnSettingsTest) covers the exact multi-consumer scenario; the unit test (AS2ConsumerConfigurationMdnSettingsTest) validates fallback behavior; the migration guide is thorough. The only blocker is the incomplete backport: the AS2AsynchronousMDNManager 10-arg constructor from main was not carried over.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

private final String password;
private final String accessToken;
private final String asyncMdnAllowedHosts;
private final SSLContext sslContext;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⛔ Compilation error (root cause): AS2AsynchronousMDNManager has no 10-arg constructor on camel-4.22.x.

The original commit on main rewrote AS2AsynchronousMDNManager to add a 10-arg constructor accepting SSLContext. That file change was silently dropped during the backport cherry-pick. On camel-4.22.x, only these constructors exist:

  • 8-arg (deprecated): (as2Version, userAgent, senderFQDN, signingCertChain, signingKey, userName, password, accessToken)
  • 9-arg: adds allowedHosts

Neither accepts SSLContext. The private final SSLContext sslContext field added here feeds only the non-existent 10-arg call — once that call is fixed to use the 9-arg constructor, this field is unused and must be removed.

On this branch AS2AsynchronousMDNManager explicitly refuses https delivery (throw new HttpException("TLS delivery of asynchronous MDNs is not supported")), so the parameter serves no purpose here.

Suggested change
private final SSLContext sslContext;

Comment on lines +601 to +611
AS2AsynchronousMDNManager asynchronousMDNManager = new AS2AsynchronousMDNManager(
AS2ServerConnection.this.as2Version,
AS2ServerConnection.this.originServer,
AS2ServerConnection.this.serverFqdn,
config.getSigningCertificateChain(),
config.getSigningPrivateKey(),
config.getMdnUserName(),
config.getMdnPassword(),
config.getMdnAccessToken(),
config.getAsyncMdnAllowedHosts(),
AS2ServerConnection.this.sslContext);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⛔ Compilation error: passing sslContext as the 10th argument — this constructor doesn't exist on camel-4.22.x.

Drop the sslContext argument and use the existing 9-arg constructor:

Suggested change
AS2AsynchronousMDNManager asynchronousMDNManager = new AS2AsynchronousMDNManager(
AS2ServerConnection.this.as2Version,
AS2ServerConnection.this.originServer,
AS2ServerConnection.this.serverFqdn,
config.getSigningCertificateChain(),
config.getSigningPrivateKey(),
config.getMdnUserName(),
config.getMdnPassword(),
config.getMdnAccessToken(),
config.getAsyncMdnAllowedHosts(),
AS2ServerConnection.this.sslContext);
AS2AsynchronousMDNManager asynchronousMDNManager = new AS2AsynchronousMDNManager(
AS2ServerConnection.this.as2Version,
AS2ServerConnection.this.originServer,
AS2ServerConnection.this.serverFqdn,
config.getSigningCertificateChain(),
config.getSigningPrivateKey(),
config.getMdnUserName(),
config.getMdnPassword(),
config.getMdnAccessToken(),
config.getAsyncMdnAllowedHosts());

String asyncMdnAllowedHosts)
throws IOException {
this.asyncMdnAllowedHosts = asyncMdnAllowedHosts;
this.sslContext = sslContext;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ After removing the sslContext field (line 92) and the 10-arg constructor call, this assignment becomes a compilation error too. The sslContext constructor parameter is already passed to RequestAcceptorThread — storing it as a field is unnecessary.

Suggested change
this.sslContext = sslContext;

`mdnAccessToken` and `asyncMdnAllowedHosts`) to the messages received on its own pattern.

The settings of the shared server connection still come from the first endpoint created on the port:
`sslContextParameters` and `sslContext` (used for the TLS listener and for the https delivery of asynchronous MDNs),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📝 Inaccurate on camel-4.22.x: AS2AsynchronousMDNManager on this branch explicitly refuses https delivery with throw new HttpException("TLS delivery of asynchronous MDNs is not supported"). The claim that sslContext is used "for the https delivery of asynchronous MDNs" is misleading here — it is used for the TLS listener only.

Suggested change
`sslContextParameters` and `sslContext` (used for the TLS listener and for the https delivery of asynchronous MDNs),
`sslContextParameters` and `sslContext` (used for the TLS listener),

@gnodet gnodet added the lts label Oct 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@davsclaus davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

TL;DR

The fix matches #28274, but the branch does not compile, and the conflict resolution brought in code and docs that exist only on main.

Blockers

  • camel-as2-api does not compile: AS2ServerConnection.java:601-611 calls a 10-argument AS2AsynchronousMDNManager constructor that camel-4.22.x does not have (CI: [601,68] no suitable constructor found). The four open threads from the automated review (lines 92, 601-611 and 677, and as2-component.adoc:109) describe the fix.

Other findings: 4

Note on the cause: #28274 did not change AS2AsynchronousMDNManager.java. The constructor with SSLContext comes from CAMEL-24474 (#26164), a main-only feature for TLS delivery of asynchronous MDNs. So the fix is to drop the argument, as the inline suggestions do, and not to backport that constructor. For the same reason the new sentence at as2-component.adoc:109 is not true on this branch: here AS2AsynchronousMDNManager refuses https delivery.

Extra docs. as2-component.adoc:59-102 (and the catalog copy) add the whole == Usage section with the YAML example. That section comes from CAMEL-25736 (#28026), which is not on camel-4.22.x. #28274 only adds the two paragraphs after it. Please keep only those two paragraphs, or say in the PR description that the example is included on purpose.

Extra refactoring (optional). AS2ServerConnection.java:559 and 584-637 move the asynchronous MDN code into a new handleAsynchronousMDN method, as on main. The behaviour is the same. The 4.18.x backport (#28348) shows the smaller change: replace the arguments in place.

Upgrade guide section. The note at camel-4x-upgrade-guide-4_22.adoc:2090 is at the end of the file, inside "Upgrading Camel 4.21 to 4.22". The change ships in 4.22.3, so it belongs under "Upgrading from 4.22.2 to 4.22.3" (line 14).

Main sync. The 4.22 guide on main does not have this note yet, and #28274 says the backports add it to the 4.22 and 4.18 guides on main. Please add it there, in the "4.22.2 to 4.22.3" section. The 4.18.6 note can go in the same main PR.

Everything else matches #28274: AS2ConsumerConfiguration, AS2Consumer, AS2Configuration, both new tests, and the generated files. The new tests have not run on this branch yet, because the build stops at the compile error.


Reviewed with Claude Code on behalf of @davsclaus. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.

@davsclaus

Copy link
Copy Markdown
Contributor

@gnodet friendly ping: this one has a merge conflict, and camel-as2-api does not compile (AS2ServerConnection.java:601 calls an AS2AsynchronousMDNManager constructor that only exists on main). See the reviews from 2026-10-23.

Claude Code on behalf of davsclaus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport indicate that a Pull request is a backport from a fix from the main branch catalog components docs dsl

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants