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 ??