[rabbitmq-discuss] Ruby Gem with Unicorn server

Michael Klishin michael.s.klishin at gmail.com
Tue Jan 17 19:42:10 GMT 2012


> Question... typically only 1 channel is needed per application right?

For Web apps that just publish messages and never consume them, yes.

For consumer applications, you almost always end up with multiple channels because
channels should not be shared between threads and error handling in AMQP 0.9.1 is per-channel (connection-level exceptions usually
indicate misconfiguration or serious client bugs). Another common reason for separation is to be able to see separate message flows
in the RabbitMQ Web UI.

You can always start with 1 channel (this is why AMQP.channel accessor is there, so you don't have to decide where to assign it) and add more,
often moving to this technique: 


but It is not uncommon to see publishing being done as

AMQP.channel.default_exchange.publish(payload, …)

initially. This is not discouraged.

Channels on the wire are just integers every message carries so they are very cheap to create and maintain in terms of resources,
both for clients and RabbitMQ itself.



More information about the rabbitmq-discuss mailing list