Skip to content

thiagozs/go-rabbitmq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-rabbitmq - Wrapper for rabbitmq

Connect to rabbitmq

 opts := []rmq.Options{
  rmq.Url("amqp://guest:guest@localhost:5672"),
  rmq.Durable(false),
  rmq.AutoAck(true),
  rmq.Exclusive(false),
  rmq.NoLocal(false),
  rmq.NoWait(false),
  rmq.Args(nil),
  rmq.Name("hello"),
}

  rbt, err := rmq.NewService(opts...)
  utils.FailOnError(err, "Failed to connect to RabbitMQ")
  defer rbt.Close()

Create a Queue

    q, err := rbt.QueueDeclare("hello", false, false, false, false, nil)
    utils.FailOnError(err, "Failed to declare queue")

Publish a Message

    err := rbt.Publish("exchange","subject", []byte("Hello World!"))
    utils.FailOnError(err, "Failed to publish message")

More examples can be found at examples.

Versioning and license

We use SemVer for versioning. You can see the versions available by checking the tags on this repository.

For more details about our license model, please take a look at the LICENSE file


2022, thiagozs

About

Rabbit MQ Wrapper

Resources

License

Stars

Watchers

Forks

Packages

No packages published