3

Like the title says.

Is there a way to use gRPC in combination with some kind of message broker/ Queue with .NET?

It does not have to be RabbitMQ. I am open to use alternatives.

enter image description here\

I want to send messages from 1 client to 2 servers but i need to prevent that the 2 servers process the request at the same time, hence the message queue/broker.

WeNeedAnswers
  • 4,620
  • 2
  • 32
  • 47
Clumpsypenguin
  • 311
  • 5
  • 19

3 Answers3

0

You could do this with Azure Service Bus. Client could be on-premises or in Azure. Same for servers 1 and 2.

Note: You should be able to gRPC to Azure Service Bus, but you may need to use HTTP/REST function for topic/subscription to send messages to Server 1 or 2.

Another approach to consider:

https://grpc.io/blog/grpc-load-balancing/

dkeeshin
  • 11
  • 1
0

I think to best answer your question, I assume the reason why you want to use rabbitmq with grpc is because you'd like to have better decoupling from client to servers while still using rpc pattern. With this in mind, this might be something you actually need:

  1. rabbitmq - rpc pattern (could find tutorial from rabbitmq docs)
  2. google protobuf to be your contracts between services

The idea is that client is connected to the queue with two channels, one is to send message where you can specify the destination to be a specific service (in your scenario service1); two is a reply channel where service1 would be sending message back to the client.

0

Kafka and the confuent platform supports grpc and google proto-buffer as a serialization schema.

Gakis41
  • 1,831
  • 2
  • 11
  • 13