Package de.otto.synapse.endpoint
Class MessageFilter
java.lang.Object
de.otto.synapse.endpoint.MessageFilter
- All Implemented Interfaces:
MessageInterceptor
A
MessageInterceptor that is used to filter messages using some predicate.
MessageFilter will usually be chained using a InterceptorChain.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionfinal TextMessageintercept(TextMessage message) Intercept a message and return the same message, a modified version of the incoming message, or null, if the message should be filtered out and dropped by theAbstractMessageEndpointstatic MessageFiltermessageFilter(Predicate<TextMessage> predicate) Creates aMessageFilterthat is used to filter messages frommessage endpoints.
-
Method Details
-
messageFilter
Creates aMessageFilterthat is used to filter messages frommessage endpoints.Messages will be dropped, if
predicate.test(message)isfalse- Parameters:
predicate- the predicate used to select messages- Returns:
- MessageFilter
-
intercept
Intercept a message and return the same message, a modified version of the incoming message, or null, if the message should be filtered out and dropped by theAbstractMessageEndpointTheinterceptmethod of a MessageFilter returns the intercepted message, if the filter predicate returnstrue. Otherwise,nullis returned and the message will be dropped.- Specified by:
interceptin interfaceMessageInterceptor- Parameters:
message- the channel-layer message with payload-type beeing a String- Returns:
- intercepted version of the message, or null if the message should be dropped.
-