Class: Synapse::Configuration::SimpleCommandBusDefinitionBuilder

Inherits:
DefinitionBuilder show all
Defined in:
lib/synapse/configuration/component/command_bus/simple_command_bus.rb

Overview

TODO:

Support for interceptors and filters

Definition builder used to create a simple command bus

Examples:

The minimum possible effort to build a command bus

simple_command_bus

Create a command bus with an alternate identifier and handler tag

simple_command_bus :alt_command_bus do
  use_handler_tag :alt_command_handler
end

Direct Known Subclasses

AsynchronousCommandBusDefinitionBuilder

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, #identified_by, #initialize, #register_definition, #resolve, #resolve_tagged, #tag, #use_factory, #use_instance

Constructor Details

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

Instance Method Details

#use_handler_tag(handler_tag) ⇒ undefined

Changes the tag to use to automatically subscribe command handlers

Note that command handlers that are tagged must support self-subscription to the command bus. An example of a handler capable of doing so is the wiring command handler.

Parameters:

  • handler_tag (Symbol)

Returns:

  • (undefined)


22
23
24
# File 'lib/synapse/configuration/component/command_bus/simple_command_bus.rb', line 22

def use_handler_tag(handler_tag)
  @handler_tag = handler_tag
end

#use_rollback_policy(rollback_policy) ⇒ undefined

Changes the rollback policy to use for the command bus

By default, the command bus will always rollback on an exception

Parameters:

  • rollback_policy (Symbol)

Returns:

  • (undefined)


32
33
34
# File 'lib/synapse/configuration/component/command_bus/simple_command_bus.rb', line 32

def use_rollback_policy(rollback_policy)
  @rollback_policy = rollback_policy
end

#use_unit_factory(unit_factory) ⇒ undefined

Changes the unit of work factory to use with this command bus

Parameters:

  • unit_factory (Symbol)

Returns:

  • (undefined)


40
41
42
# File 'lib/synapse/configuration/component/command_bus/simple_command_bus.rb', line 40

def use_unit_factory(unit_factory)
  @unit_factory = unit_factory
end