Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Messenger] AMQP configuration and MessageBus::dispatch enhancements #29950

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

Closed
bentcoder opened this issue Jan 21, 2019 · 6 comments
Closed

[Messenger] AMQP configuration and MessageBus::dispatch enhancements #29950

bentcoder opened this issue Jan 21, 2019 · 6 comments

Comments

@bentcoder
Copy link

bentcoder commented Jan 21, 2019

AMQP configuration

Based on the current configuration options, we can define only one routing_key per queue with routing_key option. This could be improved to allow us to define multiple routing keys with routing_keys options. As we all know by now a queue bound to a topic or direct exchange can have more than one routing_key. This is how it would enhance things.

e.g.

framework:
    messenger:
        transports:
            amqp:
                dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
                options:
                    ...
                    queue:
                        ...
                        routing_keys: ['key_1', 'key_2' ...]

MessageBus::dispatch

We should have a way of setting routing_key at MessageBus::dispatch() level. Whether it is via an Envelope or a Stamp.

e.g.

$bus->dispatch(
     new Envelop(
          new MyMessage(...),
          new RoutingKeyStamp('key_1')
     )
);
$bus->dispatch(
     (new Envelop(
          new MyMessage(...)
     ))
     ->with(new RoutingKeyStamp('key_1'));
);

Not as critical as the ones above for now but:

It would also be nice to see a:

  • Remote Procedure Call (RPC) feature which returns response/result back to MessageBus::dispatch(). This is obviously a synchronise call.
  • Dead-Letter Exchange feature
@hoebelix
Copy link

hoebelix commented Feb 12, 2019

The dead-letter exchange feature seems to work like this:

framework:
    messenger:
        transports:
            amqp:
                dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
                options:
                    ...
                    queue:
                        ...
                        arguments:
                          x-dead-letter-exchange: Name of dead letter exchange

@bentcoder
Copy link
Author

Thanks @hoebelix - I've opened up an issue regarding to it. #30218

@bentcoder
Copy link
Author

AMQP configuration

This section is to be solved by #30770

MessageBus::dispatch

This section is to be solved by #30008

Dead-Letter Exchange feature

This section is to be solved by #30218

Remote Procedure Call (RPC) feature

No news about this section yet!

@fabpot fabpot closed this as completed Apr 6, 2019
sroze added a commit that referenced this issue Apr 6, 2019
…essage publishing (G15N, sroze)

This PR was merged into the 4.3-dev branch.

Discussion
----------

[messenger] Adds a stamp to provide a routing key on message publishing

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #29950
| License       | MIT
| Doc PR        | symfony/symfony-docs#11236

Adds a stamp allowing to set a `routing_key` at `MessageBus::dispatch()` level.

```php
$message = (new Envelope('message'))->with(new RoutingKeyStamp('routing_key'));
$bus->dispatch($message);
```

Commits
-------

a515635 Simply code and rename "configuration" to "options"
3151b54 [messenger] AMQP configurable routing key & multiple queues
@isopen
Copy link

isopen commented Aug 23, 2019

Maybe this is suitable for multiple routing. (Symfony 4.3)

https://gist.github.com/isopen/8255257b983f73b4e4d0899ebcacd474

@bentcoder
Copy link
Author

May I ask if RPC feature was introduced or not please? If so, could please someone share a link? I cannot find an info on that. Thanks.

@sroze
Copy link
Contributor

sroze commented Aug 29, 2019

May I ask if RPC feature was introduced or not please? If so, could please someone share a link? I cannot find an info on that. Thanks.

@bentcoder no, it wasn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants