Class: Synapse::Configuration::SimpleCommandBusDefinitionBuilder

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

Overview

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 tags

simple_command_bus :alt_command_bus do
  use_handler_tag :alt_command_handler
  use_filter_tag :alt_command_filter
  use_interceptor_tag :alt_dispatch_interceptor
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, #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_filter_tag(filter_tag) ⇒ undefined

Changes the tag to use to automatically register command filters

Parameters:

  • filter_tag (Symbol)

Returns:

  • (undefined)

See Also:



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

def use_filter_tag(filter_tag)
  @filter_tag = filter_tag
end

#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)

See Also:



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

def use_handler_tag(handler_tag)
  @handler_tag = handler_tag
end

#use_interceptor_tag(interceptor_tag) ⇒ undefined

Changes the tag to use to automatically register command filters

Parameters:

  • interceptor_tag (Symbol)

Returns:

  • (undefined)

See Also:



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

def use_interceptor_tag(interceptor_tag)
  @interceptor_tag = interceptor_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)

See Also:



52
53
54
# File 'lib/synapse/configuration/component/command_bus/simple_command_bus.rb', line 52

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)

See Also:



61
62
63
# File 'lib/synapse/configuration/component/command_bus/simple_command_bus.rb', line 61

def use_unit_factory(unit_factory)
  @unit_factory = unit_factory
end