cakephp / queue

A queue-interop compatible Queueing library
MIT License
37 stars 19 forks source link

Implement QueueTransport to enqueue emails automatically Fixes #64 #106

Closed ajibarra closed 1 year ago

ajibarra commented 1 year ago

Fixes #64

I have implemented QueueTransport to automatically enqueue emails, and SendMailJob to process those emails.

Config options are:

options: Options array to be passed to push method. It allows to keep emails on a different queue or with different params. transport: Transport class name, to be initialized into SendMailJob. Defaults to MailTransport as CakePHP does.

Initially I thought it would be a good idea config to be:

'default' => [
    'options' => QUEUE_OPTIONS
    'transport' => [
        'className' => TRANSPORT_CLASS_NAME,
        'config' => TRANSPORT_CONFIG_ARRAY
    ]
]

But to make it as simple as possible, using the existing config and just switching the className to QueueTransport and adding the actual transport is better.

Please let me know your thoughts and if everybody is ok with this change I will implement the unit tests.

Thank you!

ajibarra commented 1 year ago

Please let me know if anything else is needed here! Thank you!