Class: Synapse::Auditing::CorrelationDataProvider

Inherits:
AuditDataProvider show all
Defined in:
lib/synapse/auditing/correlation_data_provider.rb

Overview

Implementation of an audit provider that attaches a command’s identifier to each event produced as a result of the execution of that command

Constant Summary collapse

DEFAULT_CORRELATION_KEY =

Key that will be used by default

:command_id

Instance Method Summary collapse

Constructor Details

#initialize(correlation_key = DEFAULT_CORRELATION_KEY) ⇒ undefined

Parameters:

  • correlation_key (Symbol) (defaults to: DEFAULT_CORRELATION_KEY)


11
12
13
# File 'lib/synapse/auditing/correlation_data_provider.rb', line 11

def initialize(correlation_key = DEFAULT_CORRELATION_KEY)
  @correlation_key = correlation_key
end

Instance Method Details

#provide_data_for(command) ⇒ Hash

Parameters:

  • command (CommandMessage)

Returns:

  • (Hash)


17
18
19
# File 'lib/synapse/auditing/correlation_data_provider.rb', line 17

def provide_data_for(command)
  Hash[@correlation_key, command.id]
end