I am using gRPC.Core for .Net. I have setup a simple gRPC service and a client that can send a request and receive a response back using a channel to the server endpoint. I have a scenario where the client would need to periodically poll the server to see if there is any work for it to take up. Are there any examples of such implementations using Unary gRPC?
Your question is generic and unrelated to gRPC; it just so happens that you want to use gRPC to implement it. By also not including your attempt at a solution, it may be down-voted.
You could add an rpc to your service AnyWork
that may additional include a message that defines specific details of the work that the client may undertake. The server would implement the method and, if any work meeting the criteria were available, it would provide|describe it to the client.
Polling is inefficient. If you were to have many clients repeatedly asking servers for work, the servers could spend inordinate time responding to these requests.
A better approach would be to consider the server (!) triggering an event (sending a message) as work arises either: