Quantcast
Channel: Active questions tagged symfony4 - Stack Overflow
Viewing all articles
Browse latest Browse all 3925

How to set event name and delay time in Envelope?

$
0
0

I'm using symfony 4 + enqueue (https://github.com/sroze/messenger-enqueue-transport+https://packagist.org/packages/enqueue/pheanstalk) to run async jobs in beanstalk.

Right now I have:

/** * @var Symfony\Component\EventDispatcher\EventDispatcherInterface  */private $eventDispatcher;$event = new ArticleEvent("test title", "test description");$this->eventDispatcher->dispatch($event, "article.publish");

But I want this job to be processed after a delay.

Documentation brings me to refactor it like:

use Enqueue\MessengerAdapter\EnvelopeItem\TransportConfiguration;use Symfony\Component\Messenger\Envelope;$event = new ArticleEvent("test title", "test description");$transportConfig = (new TransportConfiguration())->setDeliveryDelay(5000);$this->eventDispatcher->dispatch((new Envelope($event))->with($transportConfig));

The problem here is that I don't see where to place event's name (article.publish)

(Based on https://github.com/sroze/messenger-enqueue-transport#setting-custom-configuration-on-your-message)


Viewing all articles
Browse latest Browse all 3925

Trending Articles