I am trying to write a microservice using the Go Micro framework which is going to consume from a RabbitMQ broker and Write to another.
Go Micro has a RabbitMQ plugin however it seems that if one wants to use the Go Micro abstractions (Such as micro.RegisterSubscriber
), one has to rely on a lot of global states internal to the library. I ended up setting up a consumer using micro.RegisterSubscriber
and then manually creating a separate broker with care to not use any internal global state (Such as default exchange) and then call broker.Publish
within the consumer function which meant I had to Marshal the message manually before shipping it.
Is this not a supported pattern in Go Micro? Is there any better way of going about doing something like this?
I should mention that the main reason for choosing Go Micro in this particular case is because it seems to have a reliable RabbitMQ abstraction with reconnect support which seems to be hard to come by in Go, not necessarily because I needed RPC support in this one case.