Skip to content

Instantly share code, notes, and snippets.

@adamkuipers
Created November 24, 2014 20:31
Show Gist options
  • Save adamkuipers/49d76c6494eb50d49821 to your computer and use it in GitHub Desktop.
Save adamkuipers/49d76c6494eb50d49821 to your computer and use it in GitHub Desktop.
Creating rabbitmq connection on after_fork callback.
Resque.after_fork do |job|
$rabbitmq_connection = Bunny.new(AMQP_URL)
$rabbitmq_connection.start
$rabbitmq_channel = $rabbitmq_connection.create_channel
$rabbitmq_exchange = $rabbitmq_channel.topic('stream', durable: true)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment