Module: MultipleMan

Defined in:
lib/multiple_man.rb,
lib/multiple_man/cli.rb,
lib/multiple_man/runner.rb,
lib/multiple_man/publish.rb,
lib/multiple_man/railtie.rb,
lib/multiple_man/version.rb,
lib/multiple_man/identity.rb,
lib/multiple_man/connection.rb,
lib/multiple_man/routing_key.rb,
lib/multiple_man/configuration.rb,
lib/multiple_man/mixins/listener.rb,
lib/multiple_man/model_populator.rb,
lib/multiple_man/model_publisher.rb,
lib/multiple_man/mixins/publisher.rb,
lib/multiple_man/consumers/general.rb,
lib/multiple_man/mixins/subscriber.rb,
lib/multiple_man/payload_generator.rb,
lib/multiple_man/attribute_extractor.rb,
lib/multiple_man/channel_maintenance/gc.rb,
lib/multiple_man/channel_maintenance/reaper.rb

Defined Under Namespace

Modules: CLI, ChannelMaintenance, Consumers, Listener, Publisher, Subscriber, Subscribers Classes: AttributeExtractor, Configuration, Connection, Identity, ModelPopulator, ModelPublisher, Options, PayloadGenerator, Railtie, RoutingKey, Runner

Constant Summary collapse

Error =
Class.new(StandardError)
ConsumerError =
Class.new(Error)
ProducerError =
Class.new(Error)
ConnectionError =
Class.new(Error)
VERSION =
"1.6.1"

Class Method Summary collapse

Class Method Details

.configurationObject



2
3
4
# File 'lib/multiple_man/configuration.rb', line 2

def self.configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



6
7
8
# File 'lib/multiple_man/configuration.rb', line 6

def self.configure
  yield(configuration) if block_given?
end

.disable!Object



40
41
42
# File 'lib/multiple_man.rb', line 40

def self.disable!
  configuration.enabled = false
end

.enable!Object



44
45
46
# File 'lib/multiple_man.rb', line 44

def self.enable!
  configuration.enabled = true
end

.error(ex, options = {}) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/multiple_man.rb', line 48

def self.error(ex, options = {})
  raise ex unless configuration.error_handler

  if configuration.error_handler.arity == 3
    configuration.error_handler.call(ex, options[:payload], options[:delivery_info])
  else
    configuration.error_handler.call(ex)
  end

  raise ex if configuration.reraise_errors && options[:reraise] != false
end

.loggerObject



36
37
38
# File 'lib/multiple_man.rb', line 36

def self.logger
  configuration.logger
end

.publish(klass, options) ⇒ Object



2
3
4
5
# File 'lib/multiple_man/publish.rb', line 2

def self.publish(klass, options)
  klass.send(:include, MultipleMan::Publisher)
  klass.publish options
end