Appfuel::Initialize.define('global.message_broker') do |config, container| unless config.key?(:sneakers) fail "[initializer message_broker] :sneakers not found" end consumer_keys = container['message_brokers.consumer_keys'] unless consumer_keys.is_a?(Array) fail "[initializer message_broker] message_borker.consumers must be " + " an Array" end require 'sneakers' require 'sneakers/runner' Sneakers.configure(config[:sneakers]) consumers = consumer_keys.each.inject([]) do |result, key| result << container[key] result end container.register("message_brokers.runner", Sneakers::Runner.new(consumers)) nil end