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

Command processors

Andreas Reischuck edited this page Sep 11, 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 and call 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.

Command processors should be stored in the domain/command_processors directory.

Clone this wiki locally