if (log.isDebugEnabled()) {
log.debug("Setting message selector: '" + selectorString + "'");
}
Endpoint messageEndpoint = getOrCreateEndpoint(context);
Consumer consumer = messageEndpoint.createConsumer();
if (consumer instanceof SelectiveConsumer) {
if (receiveTimeout > 0) {
return ((SelectiveConsumer) messageEndpoint.createConsumer()).receive(
context.replaceDynamicContentInString(selectorString),
context, receiveTimeout);
} else {
return ((SelectiveConsumer) messageEndpoint.createConsumer()).receive(
context.replaceDynamicContentInString(selectorString),
context, messageEndpoint.getEndpointConfiguration().getTimeout());
}
} else {
log.warn(String.format("Unable to receive selective with consumer implementation: '%s'", consumer.getClass()));
return receive(context);
}
}