简体   繁体   中英

AWS two SQS queues sending to one worker

I have an application which sends emails and performs file uploads (and image resizing). Both of these services are not used too often and are quite light.

I'm already using a SQS queue to send messages (email to/subject/body) to a worker running a Sinatra app calling the SES API, this is running fine. My question is: is it possible to send file upload messages to that same worker too? This could be on a different queue maybe.

It seems pretty wasteful to have two ec2 instances sitting there, (for the most part), doing nothing.

PS: I'm using elastic beanstalk

It would be better to introduce a attribute TYPE in your message. Message TYPE could be EMAIL/FILEUPLOAD. Based on the attribute TYPE, the worker can call the respective service with the message.

With the above approach, you would be able to process messsages with one worker & one queue. You can auto-scale the server too and there will be no problems with processing messages with multiple workers.

Sure, why not is my initial answer. What is inside the instance is totally up to you and under your complete control. Given that you have already specified the application / server utilization is quite light; you can put your other app into the same.

Just ensure the given Instance Size is fine when both are in the same instance; App Domain ( 2 apps ), application configuration doesn't intermingle among themselves.

PS : You would be using a separate queue for the new app; if in case you need to send images in the queue, you may upload the images in S3 and put their respective links in SQS Message items and process them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM