Amazon Message Queue Service (SQS) sending and confirmation -
Amazon Message Queue Service (SQS) sending and confirmation -
scenario:
a elastic beanstalk environment has few web servers sends request worker environment user sign up, etc.
problem:
when 1 of worker machines have finished task, want send confirmation web server.
it seems sqs not have "confirmation" message.
when offload job send email, want allow web server know send email successful.
one solution implement queue web server polls, however, many servers can poll on same queue, , confirmation server 1, can recieved server 2, , need wait timeout message, server 3 might intercept message. wait while server 1 confirmation.
the way worker machines "confirm" processed message deleting queue. lifecycle of queue message is:
web server sends message request. worker receives message. worker processes message successfully. worker deletes message.a message beingness deleted confirmation processed successfully.
if worker not delete message in step 4 message reappear in queue after specified timeout, , next worker check messages , process it.
if concerned message might impossible process , maintain reappearing in queue forever, can set "dead letter" queue. after message has been received specified number of times never deleted, message transferred dead letter queue, can have process dealing these unusual situations.
amazon's simple queue service developer guide has good, clear explanation of lifecycle , how can sure every message processed or moved dead letter queue special handling.
amazon-web-services amazon-sqs
Comments
Post a Comment