开发者

SQS message pulling with server start-up code OR initialize code (Ruby Rails)

开发者 https://www.devze.com 2023-03-04 17:38 出处:网络
I am process of implementing Amazon SQS service for processing lot of messages to persist it database. I am able to push the message using right_aws gem. I am also able to pull the message with exampl

I am process of implementing Amazon SQS service for processing lot of messages to persist it database. I am able to push the message using right_aws gem. I am also able to pull the message with example provided for gem.

I may end-up having multiple instances of ruby/rails server pulling and processing message (using lock and timeout feature of SQS). I would like to explore opportunity to pull the message using some start-up script or initialize during starting ruby/rails 开发者_如何学Cserver and have component always running and processing messages till server is stopped.

Can someone please share some reference on how this can be implemented?


The best way to do that, if the processing is not part of a online request you need to answer is by writing dedicated scripts that will have a loop always running (and maybe sleeping if there isn't much work to do).

You will pull a message, process it, delete it and continue to the next.

Run these processes at the machine startup and monitor them using something like Supervisord

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号