Skip to content

IBX-11974: Replaced backported message deduplication with Symfony native implementation and lock release listener - #24

Merged
bnowak merged 2 commits into
6.0from
IBX-11974-replaced-backported-message-deduplication-with-Symfony-native-implementation
Jul 24, 2026
Merged

IBX-11974: Replaced backported message deduplication with Symfony native implementation and lock release listener#24
bnowak merged 2 commits into
6.0from
IBX-11974-replaced-backported-message-deduplication-with-Symfony-native-implementation

Conversation

@bnowak

@bnowak bnowak commented Jul 22, 2026

Copy link
Copy Markdown
Contributor
🎫 Issue IBX-11974

Related PRs:

Description:

Replaces the bundle's own backported message deduplication with Symfony's native implementation, now that the required pieces ship in Symfony 7.4:

  • Removed DeduplicateMiddleware, DeduplicateStamp (contracts), DeduplicateStampNormalizer and LockKeyNormalizer in favour of Symfony\Component\Messenger\Middleware\DeduplicateMiddleware, Symfony\Component\Messenger\Stamp\DeduplicateStamp and Symfony\Component\Lock\Serializer\LockKeyNormalizer.
  • Dropped the configureLockNormalizerBackport() workaround; the native LockKeyNormalizer is wired directly.
  • Added ReleaseDeduplicationLockOnFailureListener, a backport of Symfony 8.1's listener, so the deduplication lock is released once a failed message will no longer be retried — otherwise a new dispatch of the same key stays blocked until the lock TTL expires. It is deliberately wired to the bundle's ibexa.messenger.lock_factory (not Symfony's default lock.factory) so it releases locks stored in the ibexa_messenger_lock_keys table. The backport class and its DI fallback are marked @todo for removal once the minimum Symfony version is >= 8.1.
  • Added symfony/lock as an explicit dependency and updated the PHPStan baseline and tests accordingly.

For QA:

Requires deduplication_lock_storage to be enabled.

  • Deduplication is unchanged: dispatching two messages carrying the same DeduplicateStamp key results in only one being handled while the lock is held.
  • New failure behaviour: when a handled message fails and will not be retried, its deduplication lock is released so the same key can be dispatched and processed again. Previously the key stayed blocked until the lock TTL expired.
  • With deduplication_lock_storage disabled, no deduplication middleware or failure listener is registered and behaviour is unchanged.

Documentation:

No client-facing configuration changes — deduplication_lock_storage works exactly as before. Developer-facing upgrade note for 6.0: the deduplication stamp moves from Ibexa\Contracts\Messenger\Stamp\DeduplicateStamp to Symfony's native Symfony\Component\Messenger\Stamp\DeduplicateStamp; code attaching the stamp must switch to the Symfony class.
I think that is also worth mentioning somewhere in docs (during upgrading to version 6.0), that all messages stored in ibexa_messenger_messages should be processed before or removed manually. Some stamps/messages format/contract could be changed between versions and won't work on 6.0, so starting with 6.0 ibexa version this table should be empty to ensure correct processing of background messages.

@bnowak
bnowak marked this pull request as ready for review July 22, 2026 11:34
@bnowak
bnowak requested a review from a team July 22, 2026 11:37
@konradoboza
konradoboza requested a review from a team July 22, 2026 12:02
@konradoboza konradoboza added Doc needed The changes require some documentation Ready for review labels Jul 22, 2026
Comment thread src/bundle/EventListener/ReleaseDeduplicationLockOnFailureListener.php Outdated
@bnowak
bnowak force-pushed the IBX-11974-replaced-backported-message-deduplication-with-Symfony-native-implementation branch from a4fd6f1 to 17d9d0e Compare July 24, 2026 08:26
@bnowak
bnowak merged commit 05690e0 into 6.0 Jul 24, 2026
12 checks passed
@bnowak
bnowak deleted the IBX-11974-replaced-backported-message-deduplication-with-Symfony-native-implementation branch July 24, 2026 08:29
@mnocon mnocon removed the Doc needed The changes require some documentation label Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants