Module: Hutch

Defined in:
lib/hutch.rb,
lib/hutch/cli.rb,
lib/hutch/broker.rb,
lib/hutch/config.rb,
lib/hutch/worker.rb,
lib/hutch/logging.rb,
lib/hutch/message.rb,
lib/hutch/tracers.rb,
lib/hutch/version.rb,
lib/hutch/consumer.rb,
lib/hutch/exceptions.rb,
lib/hutch/error_handlers.rb,
lib/hutch/tracers/newrelic.rb,
lib/hutch/tracers/null_tracer.rb,
lib/hutch/error_handlers/logger.rb,
lib/hutch/error_handlers/sentry.rb,
lib/hutch/error_handlers/airbrake.rb,
lib/hutch/error_handlers/honeybadger.rb

Defined Under Namespace

Modules: Config, Consumer, ErrorHandlers, Logging, Tracers Classes: AuthenticationError, Broker, CLI, ConnectionError, Exception, Message, PublishError, UnknownAttributeError, Worker, WorkerSetupError

Constant Summary collapse

VERSION =
'0.17.1'.freeze

Class Method Summary collapse

Class Method Details

.brokerObject



46
47
48
# File 'lib/hutch.rb', line 46

def self.broker
  @broker
end

.connect(options = {}, config = Hutch::Config) ⇒ Object



35
36
37
38
39
40
# File 'lib/hutch.rb', line 35

def self.connect(options = {}, config = Hutch::Config)
  unless connected?
    @broker = Hutch::Broker.new(config)
    @broker.connect(options)
  end
end

.connected?Boolean

Returns:

  • (Boolean)


50
51
52
53
54
# File 'lib/hutch.rb', line 50

def self.connected?
  return false unless broker
  return false unless broker.connection
  broker.connection.open?
end

.consumersObject



19
20
21
# File 'lib/hutch.rb', line 19

def self.consumers
  @consumers ||= []
end

.disconnectObject



42
43
44
# File 'lib/hutch.rb', line 42

def self.disconnect
  @broker.disconnect if @broker
end

.global_propertiesObject



31
32
33
# File 'lib/hutch.rb', line 31

def self.global_properties
  @global_properties ||= {}
end

.global_properties=(properties) ⇒ Object



27
28
29
# File 'lib/hutch.rb', line 27

def self.global_properties=(properties)
  @global_properties = properties
end

.loggerObject



23
24
25
# File 'lib/hutch.rb', line 23

def self.logger
  Hutch::Logging.logger
end

.publish(*args) ⇒ Object



56
57
58
# File 'lib/hutch.rb', line 56

def self.publish(*args)
  broker.publish(*args)
end

.register_consumer(consumer) ⇒ Object



15
16
17
# File 'lib/hutch.rb', line 15

def self.register_consumer(consumer)
  self.consumers << consumer
end