sroze / messenger-enqueue-transport

Uses Enqueue with Symfony's Messenger component.
MIT License
191 stars 54 forks source link

Allow override options from configuration #58

Closed IndraGunawan closed 5 years ago

IndraGunawan commented 5 years ago

from this issue #57. i propose that we allow override the producer options from transport configuration

weaverryan commented 5 years ago

Hey @IndraGunawan!

I believe this is already possible, it's just not obvious. The metadata key of the TransportConfiuguration object maps to the setter methods on the message object. So, something like this should work:

$bus->dispatch((new Envelope($message))->with(new TransportConfiguration(
    [
        'metadata' => ['deliveryDelay' => 5000
    ],
)));

Or, in the newly merged code (that I'll tag shortly):

$envelope = (new Envelope($message))
    ->with(new TransportConfiguration(['metadata' => [
        'deliveryDelay' => 10000
    ]]))
;

$bus->dispatch($envelope);

Let me know if that helps!