Repository navigation
Honour PMode ReceptionAwareness.DuplicateDetection on incoming messages - #402
Merged
Merged
Conversation
The flag was stored with the PMode but never consulted: AS4RequestHandler always ran the duplicate check. The check is now skipped when the resolved PMode explicitly disables duplicate detection; the default is unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Owner
|
Thanks, makes sense. Will be part of 4.8.0 release |
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.
Problem
PModeReceptionAwarenesshas aDuplicateDetectionflag (isDuplicateDetection(), defaulttrue), and it is serialised with the PMode, but nothing consults it when a message is received.AS4RequestHandleralways callsMetaAS4Manager.getIncomingDuplicateMgr().registerAndCheck(...), so a PMode with duplicate detection explicitly set tofalsestill getsEBMS:4001 DuplicateDetectedfor a repeated MessageId.We hit this with a receiver that does its own, storage-backed idempotency: when our processor SPI failed to persist a message (and returned an ebMS error, so no receipt was sent), the sender's resend of the same MessageId was rejected as a duplicate by phase4, although the PMode said not to detect duplicates. Our workaround is a custom
IAS4ManagerFactorywhose duplicate manager never reports duplicates.Change
AS4RequestHandlerskips the duplicate check only when the resolved PMode has aReceptionAwarenesswhoseisDuplicateDetection()isfalse. With no PMode, noReceptionAwareness, or an undefined value, behaviour is exactly as before (duplicates are detected).Tests
UserMessageDuplicateTest#testDuplicateDetectionDisabledInPMode(new): with duplicate detection disabled in the receiving PModes, the same message is accepted twice. Without the change it fails withEBMS:4001.mvn -pl phase4-lib,phase4-test test: 161 + 206 tests, 0 failures (9 existing@Ignore).Related observation, not changed here: the MessageId is registered as "seen" before the processor SPIs run and stays registered when they fail, so a sender that retries after an
EBMS:0004-style processing error getsEBMS:4001instead of a second attempt. If you think that is worth addressing (e.g. unregistering on SPI failure), I am happy to open a separate issue or PR.🤖 Generated with Claude Code