To get RabbitMQ running as a DDEV Service:
ddev get b13/ddev-rabbitmq && ddev restart
Apply the configuration:
ddev rabbitmq apply
This will apply the configuration defined in .ddev/rabbitmq/config.yaml
Install the required package:
ddev composer req symfony/amqp-messenger
Configure the amqp
transport method:
services: Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpTransportFactory: public: true Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpTransport: factory: [ '@Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpTransportFactory', 'createTransport' ] arguments: # You may want to store this in a environment variable. # Example: amqp://<username>:<password>@<host>:<port>/<vhost>/<exchange> $dsn: 'amqp://rabbitmq:rabbitmq@rabbitmq:5672/%2f/messages' # For all available options see https://github.com/symfony/amqp-messenger/blob/6.3/Transport/Connection.php#L38-L65 $options: auto_setup: true # Queue options https://github.com/symfony/amqp-messenger/blob/6.3/Transport/Connection.php#L67-L72 queues: MagicRabbit: flags: 2 # Exchange options: https://github.com/symfony/amqp-messenger/blob/6.3/Transport/Connection.php#L74-L80 exchange: type: fanout tags: - name: 'messenger.sender' identifier: 'amqp' - name: 'messenger.receiver' identifier: 'amqp'
Use the ampq
transport:
// Unset the default, so that it no longer applies unset($GLOBALS['TYPO3_CONF_VARS']['SYS']['messenger']['routing']['*']); // Set Webhook-Messages and DynamicsMessage to asynchronous transport via RabbitMQ foreach ([WebhookMessageInterface::class, MyCustomMessage::class] as $className) { $GLOBALS['TYPO3_CONF_VARS']['SYS']['messenger']['routing'][$className] = 'amqp'; // The tags identifier defines in Configuration/Services.yaml }
For more details see: