Skip to content

Described stamps for Ibexa Messenger#3272

Open
mnocon wants to merge 2 commits into
5.0from
messenger-5.0
Open

Described stamps for Ibexa Messenger#3272
mnocon wants to merge 2 commits into
5.0from
messenger-5.0

Conversation

@mnocon

@mnocon mnocon commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Target: 5.0 only for now.

Doc for:

Two things:

  1. I did not describe DeduplicateStamp, as I believe people should use the one from Symfony (https://symfony.com/doc/current/messenger.html#message-deduplication) and we should "hide" (and, hopefully, remove in 6.0) our copy
  2. The deprecation must be mentioned in the 6.0 update guide, and the SudoStamp section must be reworked for this version - I'll create a separate PR to 6.0 next week when we have the 6.0 branches ready

TODO in 6.0:

  • mention deprecation in update guide
  • remove the sentence that SudoStamp is always attached
  • remove the warning about the deprecation from the article

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

@mnocon mnocon marked this pull request as ready for review July 3, 2026 10:45
@mnocon mnocon requested a review from bnowak July 3, 2026 11:01
@bnowak

bnowak commented Jul 3, 2026

Copy link
Copy Markdown
Contributor
  1. I did not describe DeduplicateStamp, as I believe people should use the one from Symfony (https://symfony.com/doc/current/messenger.html#message-deduplication) and we should "hide" (and, hopefully, remove in 6.0) our copy

I will discuss that removal with @Steveb-p when he's back after vacations (I believe 13th this month). However, I think we could get rid of our implementation starting from 5.0. Symfony introduced that stamp in 7.3 version and in our 5.0 we already have SF 7.4 😉

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

Apart from remarks, the rest looks fine 👍
However, I'd wait with removing DeduplicateStam and merging this PR until that is discussed with @Steveb-p as he originally implemented/introduced that part 😉

## Dispatch message

Dispatch a message from your code like in the following example:
To have a task processed in the background, dispatch an appriopriate message by using the `\Symfony\Component\Messenger\MessageBusInterfac\MessageBusInterface::dispatch()` method, exactly as described in [Symfony Messenger documentation]([[= symfony_doc =]]/messenger.html#dispatching-the-message):

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.

like failure says, typo in appriopriate 😉

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.

Thank you, all typos fixed in github.com//pull/3272/changes/f68bd8d9156227d7e9978813f77900d2f276a5de 🙈

```

### Register handler
Additionally, attach message metada by using [stamps](#stamps).

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.

typo in metada

@bnowak bnowak requested review from Steveb-p and konradoboza July 3, 2026 11:49

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

But +1 to the DeduplicateStamp - its faith should be discussed and documented apart from this PR.

@mnocon

mnocon commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

However, I'd wait with removing DeduplicateStam and merging this PR until that is discussed with @Steveb-p as he originally implemented/introduced that part 😉

Ok, let's wait for Paweł's feedback

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

Summary

Status Count
🔍 Total 758326
🔗 Unique 15008
✅ Successful 7264
⏳ Timeouts 1
🔀 Redirected 26
👻 Excluded 751059
❓ Unknown 0
🚫 Errors 2
⛔ Unsupported 0

Errors per input

Errors in site/api/rest_api/rest_api_usage/rest_api_usage/index.html

Errors in site/content_management/field_types/field_type_reference/countryfield/index.html

Timeouts per input

Timeouts in site/search/search_engines/solr_search_engine/install_solr/index.html

Redirects per input

Redirects in site/release_notes/ez_platform_v1.9.0/index.html

Redirects in site/release_notes/ez_platform_v3.0/index.html

Redirects in site/release_notes/ez_platform_v3.0_deprecations/index.html

Redirects in site/release_notes/ez_platform_v3.1/index.html

Redirects in site/release_notes/ibexa_dxp_v4.2/index.html

Redirects in site/resources/new_in_doc/index.html

Full Github Actions output

@github-actions

github-actions Bot commented Jul 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

docs/infrastructure_and_maintenance/background_tasks.md@99:``` 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") =]]
docs/infrastructure_and_maintenance/background_tasks.md@101:```
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:```


The following line doesn't include file correctly: [[= include_code("code_samples/background_tasks/src/Dispatcher/SomeClassThatSchedulesExecutionInTheBackground.php") =]]
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:```

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:```

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

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.

3 participants