messenger-test | Assertions and helpers for testing your symfony/messenger | Web Framework library
kandi X-RAY | messenger-test Summary
kandi X-RAY | messenger-test Summary
Assertions and helpers for testing your symfony/messenger queues. This library provides a TestTransport that, by default, intercepts any messages sent to it. You can then inspect and assert against these messages. Sent messages are serialized and unserialized as an added check. The transport also allows for processing these queued messages.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Get the message transport .
- Reset all messages .
messenger-test Key Features
messenger-test Examples and Code Snippets
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Stamp\DelayStamp;
use Zenstruck\Messenger\Test\InteractsWithMessenger;
use Zenstruck\Messenger\Test\Transport\TestTransp
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Zenstruck\Messenger\Test\InteractsWithMessenger;
class MyTest extends KernelTestCase // or WebTestCase
{
use InteractsWithMessenger;
public function test_something(): void
{
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Zenstruck\Messenger\Test\InteractsWithMessenger;
class MyTest extends KernelTestCase // or WebTestCase
{
use InteractsWithMessenger;
public function test_something(): void
{
Community Discussions
Trending Discussions on messenger-test
QUESTION
I'm implementing messenger in company which I work for. I found problem with routing key.
I want to to send one message to two queues. Two other apps will process this queues. Everything works well, but I found problem when handler throws an exception. It doubles message sending one it two retry queues, because retry queues are matching by binding key, which is the same for this queues.
Finally with 3 retries I have 16 messages on my dlqs. Could you help me with this problem? Is it possible to create retry strategy based maybe on queue, not routing key?
My config looks like:
...ANSWER
Answered 2020-Apr-23 at 09:39Ok, I found answer myself.
I created new retry strategy. I changed queue_name_pattern
to %routing_key%_%delay%
and created my own SendFailedMessageForRetryListener
. To retry envelope I added stamp new AmqpStamp($envelope->last(AmqpReceivedStamp::class)->getQueueName())
which is used to create proper routing key for delay queue. So instead of creating queue based on exchange name I have it created based on queue name.
Two more things:
Binding keys in queue looks like:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install messenger-test
Install the library: composer require --dev zenstruck/messenger-test
Create a config/packages/test/messenger.yaml and override your transport(s) with test://: # config/packages/test/messenger.yaml framework: messenger: transports: async: test://
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page