Closed joeblew99 closed 7 years ago
@joeblew99 thanks for the note - totally agree that queues are an important part of microservice architecture. NSQ feels like a pretty solid choice here, and from my limited experience with it, seems like a great choice for applications that need to communicate in an async fashion.
Would be cool if you have any thoughts on this. I am happy to make a PR for this and contrib it back to this repo too. There are not enough examples of this around i feel.
Sounds good. Any ideas on functionality?
thanks for the response :)
Can you comment on why your not using grpc-gateway. It would get right a some of your boiler plate. I hate typing :)
Now about the idea of putting in a Message queue layer and functionality:
Lbs that work well with your setup: https://github.com/andrewwebber/cqrs
https://github.com/nvcnvn/nsq_to_couchbase
Coach DB is a controversial choice for Message queue backing i know. Couch has come along really well now and is 100% golang with offline support and full facet and text search integrated. Its compelling. Its clear that Microservices shoudl use what they want, but i need to pick one DB as a basis for the infrastructure layer of the control plane. Hope you get me.
I dont think its a huge thing to adapt what you have now to start to use some of this.
thanks for this example - really easy to follow along.
I am wanting to put a Message queue within this architecture and wanted to tun it by you and well the whole internet :) I am still trying to work out the best way, without introducing too much boiler plate into it.
Why do this ? Because then a GRPC Service can also call other GRPC services as and when they need to. This allows building larger systems of Microservices where the Choreography is emergent. Bottom up rather than top down. Essentially its the reflux pattern being used for Microservices. Nothing ground breaking but an important principle i feel.
Here is what i intend to do: The API code where the REST / JSON layer is exposed would put JSON messages onto a Message queue topic. Then the GRPC Service would listen for them on the right topic. Nothing really to it.
a Coupe of design choices thogh :)
GRPC-gateway Why not just use the GRPC-gateway to expose the GRPC services as Resftul JSON services ? The pro is that you get code gen for free. Your API code is much less boiler plate and so much less brittle. I think also you get websockets for free based on the latest code there.
NATS or NSQ ? Apart from HA style semantics, the thing that is also important is how easily it can handle websocket. The reason being because then a Microservice Or the APi layer can also push to the client (s). Dont knwo about you, but for me, its an important this. I like to design (and think about the client) as just being another service behind a message queue. SO the centre of everything is your API layer where everything comes in and out of. There are not many examples of using NQS or NATS with web sockets from what i can find.
Would be cool if you have any thoughts on this. I am happy to make a PR for this and contrib it back to this repo too. There are not enough examples of this around i feel.