Class: EventBus::Broker::Base
- Inherits:
-
Object
- Object
- EventBus::Broker::Base
- Defined in:
- lib/event_bus/broker/base.rb
Direct Known Subclasses
Constant Summary collapse
- @@connection =
nil
Class Method Summary collapse
- .close_connection ⇒ Object
- .consume(event_name, &block) ⇒ Object
- .consumers ⇒ Object
- .produce(events) ⇒ Object
Instance Method Summary collapse
Class Method Details
.close_connection ⇒ Object
14 15 16 |
# File 'lib/event_bus/broker/base.rb', line 14 def self.close_connection raise NotImplementedError.new('Must be implemented') end |
.consume(event_name, &block) ⇒ Object
18 19 20 21 22 |
# File 'lib/event_bus/broker/base.rb', line 18 def self.consume(event_name, &block) consumers[event_name] ||= begin new.consume(event_name, &block) end end |
.consumers ⇒ Object
6 7 8 |
# File 'lib/event_bus/broker/base.rb', line 6 def self.consumers @consumers ||= {} end |
.produce(events) ⇒ Object
28 29 30 |
# File 'lib/event_bus/broker/base.rb', line 28 def self.produce(events) new.produce(events) end |
Instance Method Details
#connection ⇒ Object
10 11 12 |
# File 'lib/event_bus/broker/base.rb', line 10 def connection raise NotImplementedError.new('Must be implemented') end |
#consume(event_name, &block) ⇒ Object
24 25 26 |
# File 'lib/event_bus/broker/base.rb', line 24 def consume(event_name, &block) raise NotImplementedError.new('Must be implemented') end |
#produce(events) ⇒ Object
32 33 34 |
# File 'lib/event_bus/broker/base.rb', line 32 def produce(events) raise NotImplementedError.new('Must be implemented') end |