Interface Interceptor
-
public interface InterceptorEach interceptor, configured on the method allows you to perform before, after or around interceptor logic according to your needs.
TheInterceptoris built around supporting Intercepting specific Operations, where an Operation is determined by the user of the Interceptor. In the case of the EventStore examples of Operations are: AppendToStream, LoadLastPersistedEventRelatedTo, LoadEvent, FetchStream, etc.Recommendation:
Your concreteInterceptorshould provide a method for each Concrete Operation following this pattern:
which allows concrete Interceptors to only override the Operations that it's concerned withdefault <RESULT> intercept(ConcreteOperation operation, InterceptorChain<ConcreteOperation, RESULT> interceptorChain) { return interceptorChain.proceed(); }Example of using the
InterceptorChain:var result = InterceptorChain.newInterceptorChainForOperation(operation, allInterceptorsConfigured, (interceptor, interceptorChain) -> interceptorChain.intercept(operation, interceptorChain), () -> performDefaultBehaviorForOperation(operation)) .proceed();- See Also:
InterceptorChain