Module: Lapine
- Defined in:
- lib/lapine.rb,
lib/lapine/cli.rb,
lib/lapine/dtrace.rb,
lib/lapine/errors.rb,
lib/lapine/version.rb,
lib/lapine/exchange.rb,
lib/lapine/publisher.rb,
lib/lapine/configuration.rb,
lib/lapine/test/exchange.rb,
lib/lapine/consumer/config.rb,
lib/lapine/consumer/runner.rb,
lib/lapine/annotated_logger.rb,
lib/lapine/consumer/message.rb,
lib/lapine/consumer/topology.rb,
lib/lapine/test/rspec_helper.rb,
lib/lapine/consumer/connection.rb,
lib/lapine/consumer/dispatcher.rb,
lib/lapine/consumer/middleware.rb,
lib/lapine/consumer/middleware/json_decoder.rb,
lib/lapine/consumer/middleware/error_handler.rb,
lib/lapine/consumer/middleware/message_ack_handler.rb
Defined Under Namespace
Modules: Consumer, Publisher, Test
Classes: AnnotatedLogger, CLI, Configuration, DTrace, DuplicateMiddleware, Exchange, LapineError, MiddlewareNotFound, NilExchange, UndefinedConnection, UndefinedExchange
Constant Summary
collapse
- VERSION =
'2.0.3'
Class Method Summary
collapse
Class Method Details
.add_connection(name, properties) ⇒ Object
13
14
15
|
# File 'lib/lapine.rb', line 13
def self.add_connection(name, properties)
config.connection_properties[name] = properties
end
|
.add_exchange(name, properties) ⇒ Object
17
18
19
20
21
22
|
# File 'lib/lapine.rb', line 17
def self.add_exchange(name, properties)
connection = properties[:connection]
raise UndefinedConnection.new("No connection for #{name}, properties: #{properties}") unless connection
raise UndefinedConnection.new("No connection properties for #{name}, properties: #{properties}") unless config.connection_properties[connection]
config.exchange_properties[name] = properties
end
|
.close_connections! ⇒ Object
35
36
37
|
# File 'lib/lapine.rb', line 35
def self.close_connections!
config.close_connections!
end
|
.config ⇒ Object
9
10
11
|
# File 'lib/lapine.rb', line 9
def self.config
@config ||= Configuration.new
end
|
.find_exchange(name) ⇒ Object
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/lapine.rb', line 24
def self.find_exchange(name)
exchange = config.exchanges[name]
return exchange.exchange if (exchange && exchange.connected?)
exchange_configuration = config.exchange_properties[name]
raise UndefinedExchange.new("No exchange configuration for #{name}") unless exchange_configuration
config.exchanges[name] = Lapine::Exchange.new(name, exchange_configuration)
config.exchanges[name].exchange
end
|