These paragraphs are confusing:
_You can work with the Azure Cosmos DB change feed using either a push model or a pull model. With a push model, a client requests work from a server and has business logic for processing a change. However, the complexity in checking for changes and storing state for the last processed changes is handled on the server._
_With a pull model, a server requests work, often requesting it from a central work queue. The client, in this case, not only has business logic for processing changes but also storing state for the last processed change, handling load balancing across multiple clients processing changes in parallel, and handling errors._
Here is why they are confusing:
I am trying to understand how I am supposed to interact from my code with the change feed. While doing that, based on the paragraphs, I have problem trying to answer these questions:
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@konrad-jamrozik We are checking this and we will get back to you.
Hi @konrad-jamrozik. That paragraph is just intended to be a general introduction to push model vs pull architectures. Could you keep reading the doc and let me know if that covers your questions? I'm happy to cover any remaining questions here.
@timsander1 Here is my current best bet on the meaning:
The client is my code.
The server is the change feed.
In case of the push model (paragraph 1), the change feed _pushes_ the notification to my code there is work to be done. This is written as a client requests work from a server
which appears to me to be false? I mean, the client is not requesting anything, the change feed is pushing the notification, isn't it?
In case of the client model (paragraph 2), the change feed _requests work_ from the central work queue, but this is internal implementation detail hidden from my client code. I can now query the change feed (or _pull_ from it) to process the change. Thus, in this paragraph _requesting work_ has different meaning.
Am I correct in my interpretation?
@timsander1 even if this is intended as very high level broad introduction, I would still say it would be good to have consistent meaning of the phrase _to request work_ and make sure it makes intuitive sense, that is, if X request work from Y
it means that X invokes something on Y, and Y doesn't do anything actively, just receives the call and starts processing. If my thinking is correct, the meaning of requesting work is now opposite to that, causing my confusion.
How about a rewrite like this (diff in bold)
_You can work with the Azure Cosmos DB change feed using either a push model or a pull model. With a push model, a server pushes work to a client that has business logic for processing this work. However, the complexity in checking for work and storing state for the last processed work is handled on the server._
_With a pull model, the client has to pull the work from the server. The client, in this case, not only has business logic for processing work but also storing state for the last processed work, handling load balancing across multiple clients processing work in parallel, and handling errors._
Ah, I see what you mean. I'll submit a docs update to reword that section tonight. I agree that the meaning of "request work" is a little different in paragraph 1 and paragraph 2 and that is unclear.
But yes, your assumptions are correct. For the second paragraph - "With a pull model, a server requests work, often requesting it from a central work queue." In this case, the "central work queue" is the change feed. With the pull model, you request changes from the change feed at your own pace, the changes aren't "pushed" to your code.
@timsander1 awesome, thx! :)
I like your reword :). Mind if I use that? You're welcome to submit the PR yourself if you prefer
@timsander1 ok I'll submit a PR and refer to this discussion in it.
Thanks @konrad-jamrozik and @timsander1 it looks like the issue is resolved. Closing it now.