use of org.apache.qpid.server.filter.Filterable in project qpid-broker-j by apache.
the class DirectExchangeImpl method doRoute.
@Override
public <M extends ServerMessage<? extends StorableMessageMetaData>> void doRoute(final M payload, final String routingKey, final InstanceProperties instanceProperties, final RoutingResult<M> result) {
BindingSet bindings = _bindingsByKey.get(routingKey == null ? "" : routingKey);
if (bindings != null) {
final Map<MessageDestination, String> unfilteredDestinations = bindings.getUnfilteredDestinations();
for (MessageDestination destination : unfilteredDestinations.keySet()) {
String actualRoutingKey = unfilteredDestinations.get(destination) == null ? routingKey : unfilteredDestinations.get(destination);
result.add(destination.route(payload, actualRoutingKey, instanceProperties));
}
if (bindings.hasFilteredQueues()) {
Filterable filterable = Filterable.Factory.newInstance(payload, instanceProperties);
Map<MessageDestination, FilterManagerReplacementRoutingKeyTuple> filteredDestinations = bindings.getFilteredDestinations();
for (Map.Entry<MessageDestination, FilterManagerReplacementRoutingKeyTuple> entry : filteredDestinations.entrySet()) {
FilterManagerReplacementRoutingKeyTuple tuple = entry.getValue();
String actualRoutingKey = tuple.getReplacementRoutingKey() == null ? routingKey : tuple.getReplacementRoutingKey();
if (tuple.getFilterManager().allAllow(filterable)) {
result.add(entry.getKey().route(payload, actualRoutingKey, instanceProperties));
}
}
}
}
}
Aggregations