I don’t recommend long running workers, I would go with sleep only for a short delay. # limit the max number processing per second to 10 sleep ( 0.1 ) end end sqs_client_receive_message_opts = class SyncWithExternalAPIWorker include Shoryuken :: Worker shoryuken_options queue: 'queue.fifo', auto_delete: true def perform ( sqs_msg, name ) # call an external API that supports max 10 calls per second. Shoryuken automatically sets the Message Group ID to ShoryukenMessage if it is not provided. The messages will be received in the order they were sent to their group. Message Group IDįor the Message Group ID you can either use the same message group for all messages, or group them by some business logic, let’s say account_id, or whatever that makes sense to you. There are two key attributes when working with FIFO Queues: Message Group ID and Message Deduplication ID. Shoryuken empowers the SDK by adding support for continuously polling and thread based processing, besides that, it also adds abstractions simplifying the integration with SQS, including Active Job support. Why Shoryuken? aws-sdk-ruby is great, but it’s just an API client. The examples in this post are based on Shoryuken, a SQS thread based message processor in Ruby. This post is about Amazon SQS FIFO Queues, which is a type of queue designed to guarantee that messages are processed exactly once and in the exact order that they are sent. It can be also free depending on our usage. If you need to process in background, and all that jazz, but without the overhead of managing your queue service, go for it. For those not familiar with Amazon SQS, it’s a reliable and high-scalable fully managed queue service.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |