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.

Direct Known Subclasses

WiringProcess

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id = nil) ⇒ undefined

Parameters:

  • id (String) (defaults to: nil)


24
25
26
27
28
29
30
31
32
33
34
# File 'lib/synapse/process_manager/process.rb', line 24

def initialize(id = nil)
  unless id
    id = IdentifierFactory.instance.generate
  end

  @id = id
  @correlations = CorrelationSet.new
  @active = true

  correlate_with :process_id, id
end

Instance Attribute Details

#activeBoolean (readonly) Also known as: active?

Returns True if this process is active.

Returns:

  • (Boolean)

    True if this process is active



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

def active
  @active
end

#correlationsCorrelationSet (readonly)

Returns The correlations for this process.

Returns:



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

def correlations
  @correlations
end

#idString (readonly)

Returns The unique identifier of this process.

Returns:

  • (String)

    The unique identifier of this process



12
13
14
# File 'lib/synapse/process_manager/process.rb', line 12

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.

Parameters:

  • event (EventMessage)

Returns:

  • (undefined)


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

def handle(event); end