/**
 * 
 */
package camelinaction;

import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.processor.DelegateAsyncProcessor;
import org.apache.camel.spi.InterceptStrategy;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * @author janstey
 * 
 */
public class MyInterceptor implements InterceptStrategy {
	private static final transient Log log = LogFactory
	        .getLog(MyInterceptor.class);

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.apache.camel.spi.InterceptStrategy#wrapProcessorInInterceptors(org
	 * .apache.camel.CamelContext, org.apache.camel.model.ProcessorDefinition,
	 * org.apache.camel.Processor, org.apache.camel.Processor)
	 */
	public Processor wrapProcessorInInterceptors(CamelContext context,
	        ProcessorDefinition<?> definition, final Processor target,
	        Processor nextTarget) throws Exception {
		// to make the Default channel happy
		return new DelegateAsyncProcessor(new Processor() {

			public void process(Exchange exchange) throws Exception {
				log.info("Before the processor...");
				target.process(exchange);
				log.info("After the processor...");
			}
		});
	}

}

/**
 * 
 */
package camelinaction;

import org.apache.camel.CamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.model.ProcessorDefinition;
import org.apache.camel.spi.InterceptStrategy;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * @author janstey
 * 
 */
public class MyInterceptor implements InterceptStrategy {
	private static final transient Log log = LogFactory
	        .getLog(MyInterceptor.class);

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.apache.camel.spi.InterceptStrategy#wrapProcessorInInterceptors(org
	 * .apache.camel.CamelContext, org.apache.camel.model.ProcessorDefinition,
	 * org.apache.camel.Processor, org.apache.camel.Processor)
	 */
	public Processor wrapProcessorInInterceptors(CamelContext context,
	        ProcessorDefinition<?> definition, final Processor target,
	        Processor nextTarget) throws Exception {
		return new Processor() {

			public void process(Exchange exchange) throws Exception {
				log.info("Before the processor...");
				target.process(exchange);
				log.info("After the processor...");
			}
		};
	}

}

--- 
+++ 
@@ -7,6 +7,7 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.model.ProcessorDefinition;
+import org.apache.camel.processor.DelegateAsyncProcessor;
 import org.apache.camel.spi.InterceptStrategy;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -30,14 +31,15 @@
 	public Processor wrapProcessorInInterceptors(CamelContext context,
 	        ProcessorDefinition<?> definition, final Processor target,
 	        Processor nextTarget) throws Exception {
-		return new Processor() {
+		// to make the Default channel happy
+		return new DelegateAsyncProcessor(new Processor() {
 
 			public void process(Exchange exchange) throws Exception {
 				log.info("Before the processor...");
 				target.process(exchange);
 				log.info("After the processor...");
 			}
-		};
+		});
 	}
 
 }
Return an AsyncProcessor in wrapProcessorInInterceptors to make the Default channel happy

git-svn-id: 72f01205ed0e830b17124003a563eb3e26365279@243 2ef4527c-bcc6-11de-8784-f7ad4773dbab
