Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Latest commit

 

History

History

README.md

Go code for RabbitMQ tutorials (AMQP 1.0)

Here you can find Go code examples from RabbitMQ tutorials, using the AMQP 1.0 client.

Requirements

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).

Code

Run each example from this directory with go run:

Tutorial one: "Hello World!":

go run send.go
go run receive.go

Tutorial two: Work Queues:

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

Tutorial four: Routing

go run receive_logs_direct.go info warn
go run emit_log_direct.go warn "a warning"

Tutorial five: Topics

go run receive_logs_topic.go "kern.*" "*.critical"
go run emit_log_topic.go kern.critical "A critical kernel error"

Tutorial six: RPC

go run rpc_server.go
go run rpc_client.go 10

Publisher confirms (AMQP 1.0 publish outcomes)

go run publisher_confirms.go

AMQP 1.0 Direct Reply-To RPC

go run rpc_amqp10.go

To learn more, see the package documentation and AMQP in RabbitMQ.