Class: Synapse::Command::SerializationOptimizingInterceptor
- Inherits:
-
DispatchInterceptor
- Object
- DispatchInterceptor
- Synapse::Command::SerializationOptimizingInterceptor
- Defined in:
- lib/synapse/command/interceptors/serialization.rb
Overview
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.
Instance Method Summary collapse
-
#initialize ⇒ SerializationOptimizingInterceptor
constructor
A new instance of SerializationOptimizingInterceptor.
-
#intercept(command, unit, chain) ⇒ Object
The result of the execution of the command.
Constructor Details
#initialize ⇒ SerializationOptimizingInterceptor
Returns a new instance of SerializationOptimizingInterceptor.
7 8 9 |
# File 'lib/synapse/command/interceptors/serialization.rb', line 7 def initialize @listener = SerializationOptimizingListener.new end |
Instance Method Details
#intercept(command, unit, chain) ⇒ Object
Returns The result of the execution of the command.
15 16 17 18 |
# File 'lib/synapse/command/interceptors/serialization.rb', line 15 def intercept(command, unit, chain) unit.register_listener @listener chain.proceed command end |