Module: Hutch
- Defined in:
- lib/hutch.rb,
lib/hutch/cli.rb,
lib/hutch/broker.rb,
lib/hutch/config.rb,
lib/hutch/waiter.rb,
lib/hutch/worker.rb,
lib/hutch/adapter.rb,
lib/hutch/adapter.rb,
lib/hutch/logging.rb,
lib/hutch/message.rb,
lib/hutch/tracers.rb,
lib/hutch/version.rb,
lib/hutch/consumer.rb,
lib/hutch/publisher.rb,
lib/hutch/exceptions.rb,
lib/hutch/adapters/bunny.rb,
lib/hutch/error_handlers.rb,
lib/hutch/tracers/datadog.rb,
lib/hutch/serializers/json.rb,
lib/hutch/tracers/newrelic.rb,
lib/hutch/adapters/march_hare.rb,
lib/hutch/error_handlers/base.rb,
lib/hutch/tracers/null_tracer.rb,
lib/hutch/serializers/identity.rb,
lib/hutch/acknowledgements/base.rb,
lib/hutch/error_handlers/logger.rb,
lib/hutch/error_handlers/sentry.rb,
lib/hutch/error_handlers/bugsnag.rb,
lib/hutch/error_handlers/rollbar.rb,
lib/hutch/error_handlers/airbrake.rb,
lib/hutch/error_handlers/honeybadger.rb,
lib/hutch/error_handlers/sentry_raven.rb,
lib/hutch/acknowledgements/nack_on_all_failures.rb
Defined Under Namespace
Modules: Acknowledgements, Adapters, Config, Consumer, ErrorHandlers, Logging, Serializers, Tracers
Classes: AuthenticationError, Broker, CLI, ConnectionError, Exception, Message, PublishError, Publisher, UnknownAttributeError, Waiter, Worker, WorkerSetupError
Constant Summary
collapse
- Adapter =
Adapters::BunnyAdapter
- VERSION =
'1.3.0'.freeze
- @@connection_mutex =
Mutex.new
Class Method Summary
collapse
Class Method Details
.broker ⇒ Object
57
58
59
|
# File 'lib/hutch.rb', line 57
def self.broker
@broker
end
|
.connect(options = {}, config = Hutch::Config) ⇒ Object
Connects to broker, if not yet connected.
44
45
46
47
48
49
50
51
|
# File 'lib/hutch.rb', line 44
def self.connect(options = {}, config = Hutch::Config)
@@connection_mutex.synchronize do
unless connected?
@broker = Hutch::Broker.new(config)
@broker.connect(options)
end
end
end
|
.connected? ⇒ Boolean
62
63
64
|
# File 'lib/hutch.rb', line 62
def self.connected?
broker && broker.connection && broker.connection.open?
end
|
.consumers ⇒ Object
23
24
25
|
# File 'lib/hutch.rb', line 23
def self.consumers
@consumers ||= []
end
|
.disconnect ⇒ Object
53
54
55
|
# File 'lib/hutch.rb', line 53
def self.disconnect
@broker.disconnect if @broker
end
|
.global_properties ⇒ Object
35
36
37
|
# File 'lib/hutch.rb', line 35
def self.global_properties
@global_properties ||= {}
end
|
.global_properties=(properties) ⇒ Object
31
32
33
|
# File 'lib/hutch.rb', line 31
def self.global_properties=(properties)
@global_properties = properties
end
|
.publish(*args) ⇒ Object
66
67
68
|
# File 'lib/hutch.rb', line 66
def self.publish(*args)
broker.publish(*args)
end
|
.register_consumer(consumer) ⇒ Object
19
20
21
|
# File 'lib/hutch.rb', line 19
def self.register_consumer(consumer)
self.consumers << consumer
end
|