org.axonframework.commandhandling.interceptors
Class SerializationOptimizingInterceptor

java.lang.Object
  extended by org.axonframework.commandhandling.interceptors.SerializationOptimizingInterceptor
All Implemented Interfaces:
CommandHandlerInterceptor

public class SerializationOptimizingInterceptor
extends Object
implements CommandHandlerInterceptor

Interceptor that register a unit of work listener that wraps each EventMessage in a SerializationAware message. This allows for performance optimizations in cases where storage (in the event store) and publication (on the event bus) use the same serialization mechanism.

Since:
2.0
Author:
Allard Buijze

Constructor Summary
SerializationOptimizingInterceptor()
           
 
Method Summary
 Object handle(CommandMessage<?> commandMessage, UnitOfWork unitOfWork, InterceptorChain interceptorChain)
          The handle method is invoked each time a command is dispatched through the command bus that the CommandHandlerInterceptor is declared on.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SerializationOptimizingInterceptor

public SerializationOptimizingInterceptor()
Method Detail

handle

public Object handle(CommandMessage<?> commandMessage,
                     UnitOfWork unitOfWork,
                     InterceptorChain interceptorChain)
              throws Throwable
Description copied from interface: CommandHandlerInterceptor
The handle method is invoked each time a command is dispatched through the command bus that the CommandHandlerInterceptor is declared on. The incoming command and contextual information can be found in the given unitOfWork.

The interceptor is responsible for the continuation of the dispatch process by invoking the InterceptorChain.proceed(CommandMessage) method on the given interceptorChain.

Any information gathered by interceptors may be attached to the unitOfWork. This information is made available to the CommandCallback provided by the dispatching component.

Interceptors are highly recommended not to change the type of the command handling result, as the dispatching component might expect a result of a specific type.

Specified by:
handle in interface CommandHandlerInterceptor
Parameters:
commandMessage - The command being dispatched
unitOfWork - The UnitOfWork in which
interceptorChain - The interceptor chain that allows this interceptor to proceed the dispatch process
Returns:
the result of the command handler. May have been modified by interceptors.
Throws:
Throwable - any exception that occurs while handling the command


Copyright © 2010-2016. All Rights Reserved.