-
Notifications
You must be signed in to change notification settings - Fork 83
IBX-10675: Document Ibexa Messenger and discount re-indexing in the background #2909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
59d3a0d
d812b76
302bd07
cc7267e
de5b13c
7539ab7
abdd2c0
7fde47a
3477e8d
56d1deb
d9bd01e
3656c15
5e75f6f
c3d7c29
9db3eb1
1844eec
ced8ff0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace App\Dispatcher; | ||
|
||
use Ibexa\Bundle\Messenger\Stamp\DeduplicateStamp; | ||
use Symfony\Component\Messenger\Envelope; | ||
use Symfony\Component\Messenger\MessageBusInterface; | ||
|
||
final class SomeClassThatSchedulesExecutionInTheBackground | ||
{ | ||
private MessageBusInterface $bus; | ||
|
||
public function __construct(MessageBusInterface $bus) | ||
{ | ||
$this->bus = $bus; | ||
} | ||
|
||
public function schedule(object $message): void | ||
{ | ||
// Dispatch directly. Message is wrapped with envelope without any stamps. | ||
$this->bus->dispatch($message); | ||
|
||
// Alternatively, wrap with stamps. In this case, DeduplicateStamp ensures | ||
// that if similar command exists in the queue (or is being processed) | ||
// it will not be queued again. | ||
$envelope = Envelope::wrap( | ||
$message, | ||
[new DeduplicateStamp('command-name-1')] | ||
); | ||
|
||
$this->bus->dispatch($envelope); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace App\Message; | ||
|
||
class SomeMessage | ||
{ | ||
// Add properties and methods as needed for your message. | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace App\MessageHandler; | ||
|
||
use App\Message\SomeMessage; | ||
|
||
final class SomeHandler | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is only true for Symfony 5.x. On Symfony 6 and above, that interface does not exist. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, so this is ok for v5, but the interface should be added when backporting to 4.6? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On 4.6 |
||
{ | ||
public function __invoke(SomeMessage $message): void | ||
{ | ||
// Handle message. | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.