I'm not sure if I understood your question correctly, but your application could be structured as follows (based on my understanding).
Server exposes the following methods: - Registration (unary) - DeRegistration (unary) - GetID (unary) - GetData (server-side streaming): The client expresses interest in getting new data whenever data changes, and the server can stream new data as and when new data appears. IIUC right, GetID can take a while for ID allocation to happen, and only after that the server can reply to this RPC. And you are concerned if gRPC allows the server to block on this call? Yes, the client will pass a `context.Context` object in every RPC call, and you are free to set any deadline on this context. On Saturday, August 29, 2020 at 10:09:40 AM UTC-7 [email protected] wrote: > To understand my requirement further let me give an example, > RPC messages supposed to be sent between in both direction of two gRPC > nodes (say A and B) > RPC messages type1 ->Registration, DeRegsistration and GetData are > required to be send from Node A to Node B > RPC messages type 2 -> GetID and Notification are initiated from Node B > to Node A. > Here GetID will occur only once during initialisation of application > whereas Notification message will be available at random time whenever Data > changes occur in Node B > > Problem: > Since gRPC is a client server model, Always it is necessary that client > can initiate the request, but in this case RPC message type 2: GetID and > Notification are supposed to be initiated from Other side of the channel > Let me list down two possible solution here > > Solution 1. Application can have two separate channel, one channel > for RPC message type 1 to be transferred from NodeA toNode B (n this case > NodeA will act as gRPC client and NodeB will act as gRPC Server)and another > channel for RPC message type 2 to be transferred from NodeB to NodeA in > this case Node A will be gRPC Server and NodeB will be gRPC client. Here > both RPC messages types are of unary type. > > Solution 2. Only one channel, in this case Node A will act as Client > and Node B will act as Server. RPC message type 1 is of unary rpc type, > where as RPC message type 2:Notification can be of server side streaming, > where Streaming can happen at any random time whenever Data is available, > Here whether gRPC has support to wait for data ,when data available send > the response on the wire and again wait for data till application is alive > ?? whereas for GetID request single response is enough in this case server > supposed to wait for ID Allocation, till then server has to wait for data > and response can sent when ID is allocated. > > So which among the two solution is best and optimal ?? > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/4e873136-3ff6-4152-b53e-395708f24722n%40googlegroups.com.
