public class LoggingInterceptor<T extends Message<?>> extends Object implements MessageDispatchInterceptor<T>, MessageHandlerInterceptor<T>
MessageHandlerInterceptorimplementation that logs dispatched and incoming messages, and their result, to a SLF4J logger. Allows configuration of the name under which the logger should log the statements. Dispatched, incoming messages and successful executions are logged at the
INFOlevel. Processing errors are logged using the
|Constructor and Description|
Initialize the LoggingInterceptor with the default logger name, which is the fully qualified class name of this logger.
Initialize the LoggingInterceptor with the given
|Modifier and Type||Method and Description|
Apply this interceptor to the given list of
Invoked before a Message is handled by a designated
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public LoggingInterceptor(String loggerName)
loggerName. The actual logging implementation will use this name to decide the appropriate log level and location. See the documentation of your logging implementation for more information.
loggerName- the name of the logger
messages. This method returns a function that can be invoked to obtain a modified version of messages at each position in the list.
public Object handle(@Nonnull UnitOfWork<? extends T> unitOfWork, @Nonnull InterceptorChain interceptorChain) throws Exception
MessageHandler. The interceptor is responsible for the continuation of the handling process by invoking the
InterceptorChain.proceed()method on the given
interceptorChain. The given
unitOfWorkcontains contextual information. Any information gathered by interceptors may be attached to the unitOfWork. Interceptors are highly recommended not to change the type of the message handling result, as the dispatching component might expect a result of a specific type.
MessageHandlerInterceptor<T extends Message<?>>
unitOfWork- The UnitOfWork that is processing the message
interceptorChain- The interceptor chain that allows this interceptor to proceed the dispatch process
Exception- any exception that occurs while handling the message
Copyright © 2010–2023. All rights reserved.