/**
* Create a processor which invokes the given method when an incoming message exchange is received
*/
protected Processor createConsumerProcessor(final Object pojo, final Method method, final Endpoint endpoint) {
final BeanInfo beanInfo = new BeanInfo(pojo.getClass(), invocationStrategy);
return new Processor() {
@Override
public String toString() {
return "Processor on " + endpoint;
}
public void process(Exchange exchange) throws Exception {
if (log.isDebugEnabled()) {
log.debug(">>>> invoking method for: " + exchange);
}
MethodInvocation invocation = beanInfo.createInvocation(method, pojo, exchange);
if (invocation == null) {
throw new IllegalStateException("No method invocation could be created");
}
try {
invocation.proceed();