Class: Sequent::Core::BaseCommandHandler
- Inherits:
-
Object
- Object
- Sequent::Core::BaseCommandHandler
- Extended by:
- ActiveSupport::DescendantsTracker
- Includes:
- Helpers::MessageHandler, Helpers::UuidHelper
- Defined in:
- lib/sequent/core/base_command_handler.rb
Overview
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
Direct Known Subclasses
Class Attribute Summary collapse
-
.abstract_class ⇒ Object
Returns the value of attribute abstract_class.
-
.skip_autoregister ⇒ Object
Returns the value of attribute skip_autoregister.
Method Summary
Methods included from Helpers::MessageHandler
#dispatch_message, #handle_message, included
Methods included from Helpers::UuidHelper
Class Attribute Details
.abstract_class ⇒ Object
Returns the value of attribute abstract_class.
27 28 29 |
# File 'lib/sequent/core/base_command_handler.rb', line 27 def abstract_class @abstract_class end |
.skip_autoregister ⇒ Object
Returns the value of attribute skip_autoregister.
27 28 29 |
# File 'lib/sequent/core/base_command_handler.rb', line 27 def skip_autoregister @skip_autoregister end |