Class: EventBus::Broker::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/event_bus/broker/base.rb

Direct Known Subclasses

Rabbit

Constant Summary collapse

@@connection =
nil

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.close_connectionObject

Raises:

  • (NotImplementedError)


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

.consumersObject



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

#connectionObject

Raises:

  • (NotImplementedError)


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

Raises:

  • (NotImplementedError)


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

Raises:

  • (NotImplementedError)


32
33
34
# File 'lib/event_bus/broker/base.rb', line 32

def produce(events)
  raise NotImplementedError.new('Must be implemented')
end