Prefetch count

Per default each message queue has a prefetch count of 1. This value can be changed when specifying the messaging routes:

route'local.test.index',to:'test#index',prefetch:42

Msgr and fork web server like unicorn

Per default msgr opens the rabbitmq connect when rails is loaded. If you use a multi-process web server that preloads the application (like unicorn) will lead to unexpected behavior. In this case adjust config/rabbitmq.yml and adjust autostart = false:

common: &common
uri: amqp://localhost/
autostart: false

And call inside each worker Msgr.start - e.g. in an after-fork block

Testing

Recommended configuration

test:
<<: *common
pool_class: Msgr::TestPool
raise_exceptions: true

The Msgr::TestPool pool implementation executes all consumers synchronously.
By enabling the raise_exceptions configuration flag, we can ensure that exceptions raised in a consumer will not be swallowed by dispatcher (which it usually does in order to retry consuming the message).