Queue-Centric workflow pattern
A queue is put between web tier and service tier to decouple the web tier and service tier, and to give users consistent response.
enqueue and dequeue are operations done by sender and receiver.
A challenge is to handle failure on message consuming.
repeated messages are better treated as idempotent operation (same result no matter how many times being processed). excessively repeated messages is poison message.
dequeue count on same message can help to determine poison message.
The flip side here is that you now need your users to understand that even though the
system has acknowledged their action (and a command posted), processing of that ac
tion was not immediately completed.
In cases where the user wants to be notified when their action will be completed, an
email upon completion might do the trick. This is common in ecommerce scenarios
where “your order has shipped” and other notifications of progress are common.
Sometimes users will prefer to wait around while a task completes. This requires either
that the user interface layer polls the service tier until the task completes or the service
tier proactively notifies the user interface layer. The proactive notification can be implemented using long polling. In long polling, the web client creates an HTTP connection
to the server, but the server intentionally does not respond until it has an answer
No comments:
Post a Comment