Here you can find Go code examples from RabbitMQ tutorials, using the AMQP 1.0 client.
These examples use the rabbitmq-amqp-go-client library for RabbitMQ 4.x. Get it with
go get github.com/rabbitmq/rabbitmq-amqp-go-client
A RabbitMQ node must be running on localhost with the default port (5672) and credentials (guest / guest).
Run each example from this directory with go run:
go run send.go
go run receive.go
go run new_task.go hello world
go run worker.go
Tutorial three: Publish/Subscribe
go run receive_logs.go
go run emit_log.go hello world
go run receive_logs_direct.go info warn
go run emit_log_direct.go warn "a warning"
go run receive_logs_topic.go "kern.*" "*.critical"
go run emit_log_topic.go kern.critical "A critical kernel error"
go run rpc_server.go
go run rpc_client.go 10
Publisher confirms (AMQP 1.0 publish outcomes)
go run publisher_confirms.go
go run rpc_amqp10.go
To learn more, see the package documentation and AMQP in RabbitMQ.