class Synapse::Command::SerializationOptimizingInterceptor

Interceptor that registers a unit of work listener that wraps each event message in a serialization-aware message. This provides optimization in cases where storage (in an event store) and publication (on the event bus) use the same serialization mechansim.

Public Class Methods

new() click to toggle source

@return [undefined]

# File lib/synapse/command/interceptors/serialization.rb, line 8
def initialize
  @listener = SerializationOptimizingListener.new
end

Public Instance Methods

intercept(command, unit, chain) click to toggle source

@param [CommandMessage] command @param [UnitOfWork] unit The current unit of work for this command dispatch @param [InterceptorChain] chain @return [Object] The result of the execution of the command

# File lib/synapse/command/interceptors/serialization.rb, line 16
def intercept(command, unit, chain)
  unit.register_listener @listener
  chain.proceed command
end