Module: Euston::CommandBus

Defined in:
lib/euston/command_bus.rb

Class Method Summary collapse

Class Method Details

.publish(headers, command, logger = Euston::NullLogger.instance) ⇒ Object



3
4
5
6
7
8
# File 'lib/euston/command_bus.rb', line 3

def self.publish headers, command, logger = Euston::NullLogger.instance
  aggregate = AggregateCommandMap.deliver_command headers, command, logger
  raise "No aggregate found to handle command: #{headers} #{command}" if aggregate.nil?

  Repository.save aggregate
end