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

Defined Under Namespace

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

Constant Summary collapse

VERSION =
'0.2.0'.freeze

Class Method Summary collapse

Class Method Details

.brokerObject



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

def self.broker
  @broker
end

.connect(config = Hutch::Config) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/hutch.rb', line 20

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

.connected?Boolean

Returns:

  • (Boolean)


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

def self.connected?
  @connected
end

.consumersObject



12
13
14
# File 'lib/hutch.rb', line 12

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

.loggerObject



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

def self.logger
  Hutch::Logging.logger
end

.publish(routing_key, message) ⇒ Object



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

def self.publish(routing_key, message)
  @broker.publish(routing_key, message)
end

.register_consumer(consumer) ⇒ Object



8
9
10
# File 'lib/hutch.rb', line 8

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