What's the best way to implement this shared b

2019-08-13 07:26发布

问题:

I have a web and worker tier running on Elastic Beanstalk, the worker tier is used for background processing such as delivering email. However, what I want to do is the following.

Each day, look at who should be receiving an email (triggered by a complex set of data in the web tier), the fetch the required information and email it. This also needs to be able to work at scale.

The thoughts I have at the moment are:

  1. Configure the worker tier to have access to the web tier database, have it periodically (via a cron.yaml) directly access the database to build the emails.

  2. Have the web tier set up and manage a list of scheduled emails, which contains all the required information denormalised, in which the worker tier (via a cron.yaml) periodically polls and actions.

The second option does sound a lot like SQS, but the difference is these emails could be up to a month in the future at a specific time, which it sounds like SQS couldn't offer.

How would you do this? Any better ideas?

Thanks, Dan