Class: Synapse::Command::DuplicationCleanupInterceptor
- Inherits:
-
DispatchInterceptor
- Object
- DispatchInterceptor
- Synapse::Command::DuplicationCleanupInterceptor
- Defined in:
- lib/synapse/command/duplication.rb
Overview
Interceptor that removes commands from the duplication recorder if their execution results in a transient error (like concurrency error) being raised. This way, the same command can be retried by the client or command gateway
Instance Method Summary collapse
- #initialize(recorder) ⇒ undefined constructor
-
#intercept(command, unit, chain) ⇒ Object
The result of the execution of the command.
Constructor Details
#initialize(recorder) ⇒ undefined
25 26 27 |
# File 'lib/synapse/command/duplication.rb', line 25 def initialize(recorder) @recorder = recorder end |
Instance Method Details
#intercept(command, unit, chain) ⇒ Object
Returns The result of the execution of the command.
33 34 35 36 37 38 39 40 |
# File 'lib/synapse/command/duplication.rb', line 33 def intercept(command, unit, chain) begin chain.proceed command rescue TransientError @recorder.forget command raise end end |