Class AllowListMessageHeaderSelector
java.lang.Object
org.springframework.integration.selector.AllowListMessageHeaderSelector
- All Implemented Interfaces:
GenericSelector<Message<?>>,MessageSelector
The
MessageSelector implementation to apply patterns on the value
of the specified header in the message.
If no header value, the message is accepted by default.
Set setAcceptNulls(boolean) to false to reject messages with null header values.
Otherwise, it is accepted only if the header value matches one of the patterns positively.
This selector can be used in any scenario where the message's metadata should be trusted before it is used in the downstream flow.
- Since:
- 6.5.9
- Author:
- Artem Bilan
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAllowListMessageHeaderSelector(String header, String... patterns) Create an instance with the specified header and patterns. -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidsetAcceptNulls(boolean acceptNulls) Whether null values from the header are considered as valid.
-
Constructor Details
-
AllowListMessageHeaderSelector
Create an instance with the specified header and patterns.- Parameters:
header- the message header to validate.patterns- the simple patterns to match ignoring a case; also supports negated ('!') patterns. First match wins (positive or negative).
-
-
Method Details
-
setAcceptNulls
public void setAcceptNulls(boolean acceptNulls) Whether null values from the header are considered as valid.- Parameters:
acceptNulls- false to not accept null values.
-
accept
- Specified by:
acceptin interfaceGenericSelector<Message<?>>- Specified by:
acceptin interfaceMessageSelector
-