Skip to content

Described DeduplicateStamp - #3317

Open
mnocon wants to merge 4 commits into
5.0from
dedupllicate-stamp
Open

Described DeduplicateStamp#3317
mnocon wants to merge 4 commits into
5.0from
dedupllicate-stamp

Conversation

@mnocon

@mnocon mnocon commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Target: 5.0, 4.6, 6.0

Some minor changes for 4.6 will be needed (adjusting the version)

In 6.0 Deduplicate stamp is removed, so the whole section can be removed.

The deprecation is mentioned in #3279 already

@github-actions

Copy link
Copy Markdown

Preview of modified files

Preview of modified Markdown:

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown

Summary

Status Count
🔍 Total 736648
🔗 Unique 14766
✅ Successful 6195
⏳ Timeouts 0
🔀 Redirected 0
👻 Excluded 730453
❓ Unknown 0
🚫 Errors 0
⛔ Unsupported 0

Full Github Actions output

@mnocon
mnocon marked this pull request as ready for review July 23, 2026 14:03
@mnocon
mnocon requested a review from bnowak July 23, 2026 14:05

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.

This is not entirely true. Our ibexa.messenger.bus supports only default middleware/stamps with basic functionality of messenger + our implemented middlewares/stamps. What it supports is explicitly configured by us, and below is the current list:

shortly, I wouldn't mention that we support (all) stamps available in Symfony because it's not true. All supported Symfony stamps are the most basic ones, which deliver only basic messenger functionality.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks! I've also asked Claude to analyze this, and all of this combined (with me checking the Claude results ofc) results in:

530621a

Hope it's ok now

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.

I think it's correct now.
However, @Steveb-p could you double-check that I didn't miss anything here, please? :)

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.

We might consider working on it some more to allow adding of other Symfony middleware, especially since currently we need to perform manual adjustments.

@mnocon
mnocon requested a review from bnowak July 30, 2026 14:33
@mnocon
mnocon requested a review from Steveb-p August 3, 2026 09:03
Comment thread docs/infrastructure_and_maintenance/background_tasks.md Outdated
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

code_samples/ change report

Before (on target branch)After (in current PR)

code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php


code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php

docs/infrastructure_and_maintenance/background_tasks.md@99:``` php
docs/infrastructure_and_maintenance/background_tasks.md@100:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 1, 3) =]]
docs/infrastructure_and_maintenance/background_tasks.md@101:
docs/infrastructure_and_maintenance/background_tasks.md@102:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 8, 13) =]]
docs/infrastructure_and_maintenance/background_tasks.md@103:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 15, 20) =]]
docs/infrastructure_and_maintenance/background_tasks.md@104:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 25, 26) =]]
docs/infrastructure_and_maintenance/background_tasks.md@105:```
docs/infrastructure_and_maintenance/background_tasks.md@109:``` php
docs/infrastructure_and_maintenance/background_tasks.md@110:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 1, 3) =]]
docs/infrastructure_and_maintenance/background_tasks.md@111:
docs/infrastructure_and_maintenance/background_tasks.md@112:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 9, 14) =]]
docs/infrastructure_and_maintenance/background_tasks.md@113:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 16, 21) =]]
docs/infrastructure_and_maintenance/background_tasks.md@114:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 29, 30) =]]
docs/infrastructure_and_maintenance/background_tasks.md@115:```

001⫶<?php declare(strict_types=1);
002⫶
003⫶namespace App\Dispatcher;
004⫶
005⫶use Symfony\Component\Messenger\MessageBusInterface;
006⫶
007⫶final readonly class SomeClassThatSchedulesExecutionInTheBackground
008⫶{
009⫶ public function __construct(
010⫶ private MessageBusInterface $bus,
011⫶ ) {
012⫶ }
013⫶
014⫶ public function schedule(object $message): void
015⫶ {
016⫶ $this->bus->dispatch($message);
017⫶ }
018⫶}


001⫶<?php declare(strict_types=1);
002⫶
003⫶namespace App\Dispatcher;
004⫶
005⫶use Symfony\Component\Messenger\MessageBusInterface;
006⫶
007⫶final readonly class SomeClassThatSchedulesExecutionInTheBackground
008⫶{
009⫶ public function __construct(
010⫶ private MessageBusInterface $bus,
011⫶ ) {
012⫶ }
013⫶
014⫶ public function schedule(object $message): void
015⫶ {
016⫶ $this->bus->dispatch($message);
017⫶ }
018⫶}

docs/infrastructure_and_maintenance/background_tasks.md@131:``` php
docs/infrastructure_and_maintenance/background_tasks.md@132:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 6, 6, remove_indent=True) =]]
docs/infrastructure_and_maintenance/background_tasks.md@133:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 8, 9, remove_indent=True) =]]
docs/infrastructure_and_maintenance/background_tasks.md@134:
docs/infrastructure_and_maintenance/background_tasks.md@135:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 24, 24, remove_indent=True) =]]
docs/infrastructure_and_maintenance/background_tasks.md@136:```
docs/infrastructure_and_maintenance/background_tasks.md@153:``` php
docs/infrastructure_and_maintenance/background_tasks.md@154:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 6, 6, remove_indent=True) =]]
docs/infrastructure_and_maintenance/background_tasks.md@155:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 9, 9, remove_indent=True) =]]
docs/infrastructure_and_maintenance/background_tasks.md@156:
docs/infrastructure_and_maintenance/background_tasks.md@157:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 27, 28, remove_indent=True) =]]
docs/infrastructure_and_maintenance/background_tasks.md@158:```

001⫶use Ibexa\Contracts\Messenger\Stamp\DeduplicateStamp;
002⫶use Symfony\Component\Messenger\MessageBusInterface;
003⫶
004⫶$deduplicationKey = 'my_message.project.<key_based_on_message>';
005⫶$this->bus->dispatch($message, [new DeduplicateStamp($deduplicationKey)]);

docs/infrastructure_and_maintenance/background_tasks.md@173:``` php
docs/infrastructure_and_maintenance/background_tasks.md@174:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 7, 7, remove_indent=True) =]]
docs/infrastructure_and_maintenance/background_tasks.md@175:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 9, 10, remove_indent=True) =]]
docs/infrastructure_and_maintenance/background_tasks.md@176:
docs/infrastructure_and_maintenance/background_tasks.md@177:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 25, 25, remove_indent=True) =]]
docs/infrastructure_and_maintenance/background_tasks.md@178:```

001⫶use Ibexa\Contracts\Messenger\Stamp\SudoStamp;
002⫶use Symfony\Component\Messenger\MessageBusInterface;
003⫶
004⫶
005⫶$this->bus->dispatch($message, [new SudoStamp()]);


001⫶use Ibexa\Contracts\Messenger\Stamp\SudoStamp;
002⫶use Symfony\Component\Messenger\MessageBusInterface;
003⫶
004⫶
005⫶$this->bus->dispatch($message, [new SudoStamp()]);

docs/infrastructure_and_maintenance/background_tasks.md@148:``` php
docs/infrastructure_and_maintenance/background_tasks.md@149:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 5, 5, remove_indent=True) =]]
docs/infrastructure_and_maintenance/background_tasks.md@150:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 7, 9, remove_indent=True) =]]
docs/infrastructure_and_maintenance/background_tasks.md@151:
docs/infrastructure_and_maintenance/background_tasks.md@152:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 22, 23, remove_indent=True) =]]
docs/infrastructure_and_maintenance/background_tasks.md@153:```
docs/infrastructure_and_maintenance/background_tasks.md@190:``` php
docs/infrastructure_and_maintenance/background_tasks.md@191:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 5, 5, remove_indent=True) =]]
docs/infrastructure_and_maintenance/background_tasks.md@192:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 8, 10, remove_indent=True) =]]
docs/infrastructure_and_maintenance/background_tasks.md@193:
docs/infrastructure_and_maintenance/background_tasks.md@194:[[= include_code('code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php', 23, 24, remove_indent=True) =]]
docs/infrastructure_and_maintenance/background_tasks.md@195:```

001⫶use Ibexa\Contracts\Core\Repository\PermissionResolver;
002⫶use Ibexa\Contracts\Messenger\Stamp\UserPermissionStamp;
003⫶use Symfony\Component\Messenger\MessageBusInterface;
004⫶
005⫶
006⫶$currentUserId = $this->permissionResolver->getCurrentUserReference()->getUserId();
007⫶$this->bus->dispatch($message, [new UserPermissionStamp($currentUserId)]);


001⫶use Ibexa\Contracts\Core\Repository\PermissionResolver;
002⫶use Ibexa\Contracts\Messenger\Stamp\UserPermissionStamp;
003⫶use Symfony\Component\Messenger\MessageBusInterface;
004⫶
005⫶
006⫶$currentUserId = $this->permissionResolver->getCurrentUserReference()->getUserId();
007⫶$this->bus->dispatch($message, [new UserPermissionStamp($currentUserId)]);

Download colorized diff

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.

We do add support for it in 6.x, right? I don't remember what we agreed on eventually :D

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.

In 5.x, we keep our implementation of stamp and middleware.
In 6.x, we replace it with SF implementation 😉

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, I'll make this change when cherry-picking this to 6.0:
#3317 (comment)

And the deprecation is mentioned already as well

@mnocon
mnocon requested a review from a team August 3, 2026 09:47
@ibexa-workflow-automation-1
ibexa-workflow-automation-1 Bot requested review from adriendupuis, dabrt and julitafalcondusza and removed request for a team August 3, 2026 09:48

@julitafalcondusza julitafalcondusza 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.

Two small remarks.

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.

Suggested change
1. Inject the `ibexa.messenger.bus` service as an object implementing the `Symfony\Component\Messenger\MessageBusInterface` interface.

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.

Suggested change
The following example shows how you can attach the `DeduplicateStamp` to the message:

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.

4 participants