class Synapse::ProcessManager::Process
Processes are used to maintain the state of long-running business transactions
The term process is used in Enterprise Integration Patterns to describe a mechanism used to “maintain the state of the sequence and determine the next processing step based on intermediate results” (Hohpe 279). Processes are also called sagas in some CQRS frameworks.
Consider using the implementation of a process that uses the mapping DSL.
@abstract
Attributes
@return [Boolean] True if this process is active
@return [Boolean] True if this process is active
@return [CorrelationSet] The correlations for this process
@return [String] The unique identifier of this process
Public Class Methods
@param [String] id @return [undefined]
# File lib/synapse/process_manager/process.rb, line 26 def initialize(id = nil) @id = id ||= IdentifierFactory.instance.generate @correlations = CorrelationSet.new @active = true correlate_with :process_id, id end
Public Instance Methods
Handles the given event
The actual result of the processing depends on the implementation of the process. Implementations are highly discouraged from throwing exceptions.
@abstract @param [EventMessage] event @return [undefined]
# File lib/synapse/process_manager/process.rb, line 42 def handle(event) raise NotImplementedError end
Protected Instance Methods
Correlates this process instance with the given key and value
@api public @param [Symbol] key @param [String] value @return [undefined]
# File lib/synapse/process_manager/process.rb, line 54 def correlate_with(key, value) @correlations.add(Correlation.new(key, value)) end
Dissociates this process instance from the given key and value
@api public @param [Symbol] key @param [String] value @return [undefined]
# File lib/synapse/process_manager/process.rb, line 64 def dissociate_from(key, value) @correlations.delete(Correlation.new(key, value)) end
Marks this process as finished @return [undefined]
# File lib/synapse/process_manager/process.rb, line 70 def finish @active = false end