public class DefaultMessageSelector extends java.lang.Object implements MessageSelector
message type or
the address of the endpoint they are addressed to.
Selection criteria can be specified in a generic way by means of the setSelectionProperty(int, List) method. This method allows declaration of expected values for
each property in question. A message will match those criteria only if it has matching values for
all the given properties.
| Modifier and Type | Field and Description |
|---|---|
static int |
ENDPOINT_REFERENCE
Property denoting a selection based on the target
endpoint reference
of the message (i.e. |
static int |
MESSAGE_TYPE
Property denoting a selection based on the message type.
|
| Constructor and Description |
|---|
DefaultMessageSelector()
Create a new default message selector.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
matches(Message msg)
Decides whether the given message meets the selection criteria of this message selector
instance.
|
void |
setSelectionProperty(int property,
List values)
Adds a "selection rule" by specifying a message
property and
declaring a list of allowed values for this property. |
public static final int MESSAGE_TYPE
public static final int ENDPOINT_REFERENCE
endpoint reference
of the message (i.e. its WS-Addressing [destination] property). The [destination] property is
actually an IRI consisting of the [address] property of the target's endpoint reference.
Nevertheless, when specifying a selection rule by means of setSelectionProperty(int,
List) method, the provided List values is expected to contain EndpointReference instances rather than URIs.public DefaultMessageSelector()
public boolean matches(Message msg)
MessageSelectormatches in interface MessageSelectormsg - the message to decide upontrue, if the configured selection rules accept the message, false otherwisepublic void setSelectionProperty(int property,
List values)
property and
declaring a list of allowed values for this property. Each message, which has a
value for this property that is contained within values, will be considered for a
match. In case the provided list of values is null or empty, a
message will always match regardless of its actual value for the property.
Calling this method more than once with the same property but different
values overwrites (i.e. replaces) previously specified values for that
property.
property - the property to set expected values for; allowed values are MESSAGE_TYPE and ENDPOINT_REFERENCEvalues - a list of values the property may take in order to get matched by this selector; if empty,
then any value of the property would matchjava.lang.IllegalArgumentException - if propertyType is neither MESSAGE_TYPE nor ENDPOINT_REFERENCE