Class: Synapse::Configuration::MappingProcessManagerDefinitionBuilder

Inherits:
DefinitionBuilder
  • Object
show all
Defined in:
lib/synapse/configuration/component/process_manager/mapping_process_manager.rb

Overview

Definition builder used to create a mapping process manager

Since process managers are effectively listeners on the event bus, definitions created by this builder will be tagged with ‘:event_listener`

Examples:

The minimum possible effort to build a process manager

process_manager do
  use_process_types MoneyTransferProcess
end

Build a process manager with alternate components

process_manager :alt_process_manager do
  use_process_types MoneyTransferProcess

  use_process_repository :alt_process_repository
  use_process_factory :alt_process_factory

  # Use a different tag for subscribing to an event bus
  replace_tags :alt_event_listener
end

Instance Attribute Summary

Attributes inherited from DefinitionBuilder

#id

Instance Method Summary collapse

Methods inherited from DefinitionBuilder

#anonymous, #as_prototype, #as_singleton, build, #build_composite, #build_definition, #clear_tags, #identified_by, #initialize, #register_definition, #replace_tags, #tag, #use_factory, #use_instance

Constructor Details

This class inherits a constructor from Synapse::Configuration::DefinitionBuilder

Instance Method Details

#use_lock_manager(lock_manager) ⇒ undefined

Changes the lock manager to use with this process manager

Parameters:

  • lock_manager (Symbol)

Returns:

  • (undefined)

See Also:



29
30
31
# File 'lib/synapse/configuration/component/process_manager/mapping_process_manager.rb', line 29

def use_lock_manager(lock_manager)
  @lock_manager = lock_manager
end

#use_pessimistic_lockingundefined

Changes the lock manager to a pessimistic lock manager

Returns:

  • (undefined)

See Also:



37
38
39
# File 'lib/synapse/configuration/component/process_manager/mapping_process_manager.rb', line 37

def use_pessimistic_locking
  @lock_manager_type = ProcessManager::PessimisticLockManager
end

#use_process_factory(process_factory) ⇒ undefined

Changes the process factory to use with this process manager

Parameters:

  • process_factory (Symbol)

Returns:

  • (undefined)

See Also:



46
47
48
# File 'lib/synapse/configuration/component/process_manager/mapping_process_manager.rb', line 46

def use_process_factory(process_factory)
  @process_factory = process_factory
end

#use_process_repository(process_repository) ⇒ undefined

Changes the process repository to use with this process manager

Parameters:

  • process_repository (Symbol)

Returns:

  • (undefined)

See Also:



55
56
57
# File 'lib/synapse/configuration/component/process_manager/mapping_process_manager.rb', line 55

def use_process_repository(process_repository)
  @process_repository = process_repository
end

#use_process_types(*process_types) ⇒ undefined

Changes the process types that are hosted by this process manager

Parameters:

  • process_types (Class...)

Returns:

  • (undefined)

See Also:



64
65
66
# File 'lib/synapse/configuration/component/process_manager/mapping_process_manager.rb', line 64

def use_process_types(*process_types)
  @process_types = process_types.flatten
end