Migration from WCF to gRPC core

61 views
Skip to first unread message

Manikandan V S

unread,
Dec 10, 2022, 12:17:05 AM12/10/22
to grpc.io
We are in process of migrating WCF to gRPC core. Currently in WCF we have a duplex connection and we use the call back contract to even notify all clients on need basis. The implementation is something similar to what is explained in this question . We are trying to migrate this service to gRPC and have explored client streaming, server streaming and bi-directional streaming. None of these works for us. Is there any way that this can be implemented in gRPC.

Mark D. Roth

unread,
Dec 15, 2022, 6:09:50 PM12/15/22
to Manikandan V S, grpc.io
gRPC does not provide a way to start an RPC from the server side.  RPCs are always started from the client side.

The general approach I would recommend in this kind of situation is to use a bidi streaming call that the client keeps open at all times, so that the server can use that to send a message whenever it wants to.

Can you say more about why streaming does not work for your use-case?

On Fri, Dec 9, 2022 at 9:17 PM Manikandan V S <manika...@gmail.com> wrote:
We are in process of migrating WCF to gRPC core. Currently in WCF we have a duplex connection and we use the call back contract to even notify all clients on need basis. The implementation is something similar to what is explained in this question . We are trying to migrate this service to gRPC and have explored client streaming, server streaming and bi-directional streaming. None of these works for us. Is there any way that this can be implemented in gRPC.

--
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 grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/8a94972b-ecc1-4f8a-ac2b-152a2af9d7een%40googlegroups.com.


--
Mark D. Roth <ro...@google.com>
Software Engineer
Google, Inc.

Mark D. Roth

unread,
Dec 16, 2022, 11:14:42 AM12/16/22
to Manikandan V S, grpc. io
I think you can do something like this using a bidi stream.  For example, consider the following API:

// A message to be sent from the client to the server when the client changes the state of a component.
message ChangeComponentState {
  string name = 1;  // Component name.
  // ...other fields containing the content of the component change...
}

// A message to be sent from the server to the client to notify the client of a component state change made by another client.
message ComponentStateChangeNotification {
  string name = 1;  // Component name.
  // ...other fields containing the updated contents of the component...
}

service MyService {
  rpc ComponentStream(stream ChangeComponentState) returns (stream ComponentStateChangeNotification);
}

The idea here is that the clients will create a bidi stream when they start up and will leave that stream open as long as they are running.  Whenever the client needs to change a component, it sends a message on the stream.  Whenever the server needs to inform the client of a change to a component made by another client, it will send a message on the stream.  Either side can send messages on the stream whenever they want, as long as the stream is open.

On Fri, Dec 16, 2022 at 4:09 AM Manikandan V S <manika...@gmail.com> wrote:
The bidirectional streaming works only if the callback to client from server is happening within the scope of the original method. But the requirement for us is different as given below

1. All client registers to the server
2. One of the client make state change of a component 
3. Server then has to inform all the clients regarding the component state change. 

Let me know if there is a way to achieve this.
--
Regards,
Mani.
Reply all
Reply to author
Forward
0 new messages