Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Command processors

Robert Kranz edited this page Sep 9, 2013 · 3 revisions

Command processors only exist on the domain server. Their job is to process the command received from the controller, doing some validations and finally creating the event for further processing.

A command processor should include the ActiveDomain::CommandProcessor module abd have methodcallings of process for each command, it wants to process. The syntax for this is:

process YourCommand do |command|
 #syntax for validation is
 #command.is_valid_do do
 event YourEvent.new attributes
 #end
end

attributes should be hash, e.g. command.to_hash for using the same attributes values like the command, but only if the attributes keys are the same.

Clone this wiki locally