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/version.rb,
lib/hutch/consumer.rb,
lib/hutch/exceptions.rb,
lib/hutch/error_handlers.rb,
lib/hutch/error_handlers/logger.rb,
lib/hutch/error_handlers/sentry.rb

Defined Under Namespace

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

Constant Summary collapse

VERSION =
'0.12.0'.freeze

Class Method Summary collapse

Class Method Details

.brokerObject



49
50
51
# File 'lib/hutch.rb', line 49

def self.broker
  @broker
end

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



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

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

.connected?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/hutch.rb', line 53

def self.connected?
  @connected
end

.consumersObject



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

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

.disconnectObject



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

def self.disconnect
  if @broker
    @broker.disconnect
    @connected = false
  end
end

.global_propertiesObject



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

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

.global_properties=(properties) ⇒ Object



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

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

.loggerObject



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

def self.logger
  Hutch::Logging.logger
end

.publish(*args) ⇒ Object



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

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

.register_consumer(consumer) ⇒ Object



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

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