-
Notifications
You must be signed in to change notification settings - Fork 487
Message queue
Only for production environment
Messaging (e-mails, mostly) in Chamilo 2 is a bit different from Chamilo 1, because of using Symfony.
The general logic is that we use the Messenger transport component, which is highly configurable.
By default, we use a simple synchronous messaging mechanism, which works similarly to Chamilo 1: we send e-mails through the MailHelper class (Send() method) directly. So if you send 10k e-mails through a slow SMTP connection, it will take a considerable amount of time.
However, and this is where we enjoy Symfony's large palette of options, you can use new messenger transports by defining MESSENGER_TRANSPORT_DSN
in .env
, loading the required dependency, and updating messenger.yaml by enabling (uncommenting) the when@prod
section towards the end.
Once enabled (and the cache has been cleared), any message sent through Chamilo will pass through the configured messenger.
Doctrine transport is a DB table-based message queue.
To enable:
- Edit config/messenger.yaml file
- Uncomment the 2-parts
when@prod
block at the end - Edit .env file and set
MESSENGER_TRANSPORT_DSN=doctrine://default
- Setup the transport
php bin/console messenger:setup-transport mail_async
- Clear cache
php bin/console cache:clear
Then you can check the count of queued messages php bin/console messenger:stats mail_async
.
Or execute the queue to send the mails php bin/console messenger:consume mail_async
-
Home
- Tools and sessions
- Quiz: Importing
- Releases
- Community support strategy
- Translation management
- How to report issues
- Development
- Integration