Class: Synapse::ProcessManager::Process Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/synapse/process_manager/process.rb

Overview

This class is abstract.

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.

Direct Known Subclasses

MappingProcess

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id = nil) ⇒ undefined



26
27
28
29
30
31
32
# 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

Instance Attribute Details

#activeBoolean (readonly) Also known as: active?



20
21
22
# File 'lib/synapse/process_manager/process.rb', line 20

def active
  @active
end

#correlationsCorrelationSet (readonly)



17
18
19
# File 'lib/synapse/process_manager/process.rb', line 17

def correlations
  @correlations
end

#idString (readonly)



14
15
16
# File 'lib/synapse/process_manager/process.rb', line 14

def id
  @id
end

Instance Method Details

#handle(event) ⇒ undefined

This method is abstract.

Handles the given event

The actual result of the processing depends on the implementation of the process. Implementations are highly discouraged from throwing exceptions.

Raises:

  • (NotImplementedError)


42
43
44
# File 'lib/synapse/process_manager/process.rb', line 42

def handle(event)
  raise NotImplementedError
end