February 2015
Intermediate to advanced
198 pages
4h 17m
English
Interceptor patterns can be used to apply business rules and validations on messages that are either sent from the channel or received on it. The following four interceptors are available:
public interface ChannelInterceptor {
Message<?> preSend(Message<?> message, MessageChannel channel);
void postSend(Message<?> message, MessageChannel channel, boolean sent);
boolean preReceive(MessageChannel channel);
Message<?> postReceive(Message<?> message, MessageChannel channel);
}Adding an interceptor is straightforward: define a class that implements the ChannelInterceptor interface and then inject a reference of it in the channel definition. Here is a quick code snippet to show this:
<int:channel id="resultChannel"> <int:interceptors> ...
Read now
Unlock full access