-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ordering guarantees #6
Comments
Do you mean the on_success/on_error arguments to Event.send? These callbacks are there for async programs (think asyncio, tornado, twisted, gevent, eventlet), and are not actually called when you use celery as the dispatcher (as you would have to serialize the functions). They won't be useful until you connect thorn to an event loop. Success callbacks are called as soon as there is a response from the web request, so ordering depends on how fast the URLs respond, same with errbacks. |
Hi, If the behaviour is different between dispatchers (celery, tornado, asyncio), then please elaborate. Does the question make more sense now? |
Oops, I'm very sorry for the late reply, but my Github notification queue is miles deep :( There's no ordering guarantees in the case you mention where a user updates his username twice.
So even at the database level you cannot guarantee the order, but you will
It's impossible to solve this problem in a distributed system: you could have a distributed lock but I don't think they suit this purpose, or we could use Lamport timestamps/vector clocks, but then AFAIU the webhook consumers will be required to take an active part in the system. RabbitMQ will have some ordering guarantees such that if you send two messages from the same connection they will be received in the same order, but that falls apart if a consumer rejects the message, dies in the middle of processing, or if there's a partition in a HA setup. So messages coming from multiple clients are impossible to order, but For example when you receive the message:
You make a request to What will the endpoint use the data for? Will they associate data with the username in an internal database, then make sure usernames cannot be reused and that historical usernames point to the new name. |
Thanks for the elaborate response! 👍 I completely agree with you regarding ordering of commands (e.g update username), it's practically impossible to synchronise two mouse clicks. On the other hand there are a few ways for consumers to process the notifications in-order:
If the subscribers are not processing notifications in-order, how would they handle the following stock market scenario: Order state is updated and the following web-hooks are published after an IOC order is executed by the exchange:
The subscriber received the web-hooks in reverse order:
How will a subscriber handle this scenario? (assuming that fetching the canonical version will not provide enough context) I'm facing these challenges myself so i'm eager to hear your opinion! Thanks, |
Bump! |
Hi,
Great stuff! 👍
I didn't see any info in the documentation regarding ordering guarantees of posting callbacks (in success and failure scenarios).
Could you please elaborate?
Thanks!
Erik.
The text was updated successfully, but these errors were encountered: