class Sequent::Core::CommandHandler

Base class for command handlers CommandHandlers are responsible for propagating a command to the correct Sequent::Core::AggregateRoot or creating a new one. For example:

class InvoiceCommandHandler < Sequent::Core::BaseCommandHandler
  on CreateInvoiceCommand do |command|
    repository.add_aggregate Invoice.new(command.aggregate_id)
  end

  on PayInvoiceCommand do |command|
    do_with_aggregate(command, Invoice) {|invoice|invoice.pay(command.pay_date)}
  end
end