To implement a broker in Go, you might want to use a messaging system like RabbitMQ, which is based on the AMQP protocol. Here is an example of how to use RabbitMQ to publish and consume messages in Go:
main.go1286 chars58 lines
This code connects to a local instance of RabbitMQ, declares a queue, publishes a message to that queue, and then consumes messages from the same queue as they arrive. Of course, this is just a simple example, but it should give you an idea of how you can use RabbitMQ as a message broker in your own Go programs.
gistlibby LogSnag