8000 GitHub - zengenti/amqpextra: Extra features for streadway/amqp package. Auto reconnecting.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

zengenti/amqpextra

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Extra features for streadway/amqp package.

Auto reconnecting.

The package provides an auto reconnect feature for streadway/amqp. The approach idea is to add as little abstraction as possible. In your code instead of using *amqp.Connection you should use <-chan *amqp.Connection. The channel returns a healthy connection. You should subscribe to chan *amqp.Error to get notified when a connection is not helthy any more and you should request a new one via <-chan *amqp.Connection. The channel <-chan *amqp.Connection is closed when you explicitly closed it by calling connextra.Close() method, otherwise, it tries to reconnect in background.

See an example.

Consumer.

The package provides a handy consumer. It is aware of <-chan 5BD2 *amqp.Connection and <-chan *amqp.Error and can work with them respectively. It also starts multiple works in background and correctly stop them when needed.

See an example.

Consumer Middleware

The consumer could chain middlewares for pre precessing received message. Check an example that rejects messages without correlation_id and reply_to properties.

See an example.

Publisher.

The package provides a handy publisher. It is aware of <-chan *amqp.Connection and <-chan *amqp.Error and can work with them respectively.

See an example.

About

Extra features for streadway/amqp package. Auto reconnecting.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%
0