Hello,
  I've been playing around with interceptStrategies and recently have been
running into problems with wiretaps.  I'm trying to run some logic within
the same thread as the wiretap's referenced processor (it's a custom defined
component).  The logic is to write into the slf4j MDC, which is the reason I
need it in the same thread.  It seems, however, that the wrapped processor
from the interceptStrategy isn't run in the same thread as the wiretap,
rather it's run in the parent route thread.  What can I do to get the
wrapped processor to run in the same thread?

InterceptStrategy:

public class PlatformHeadersMDCInterceptStrategy implements
InterceptStrategy {
        private static final Logger LOG =
LoggerFactory.getLogger(PlatformHeadersMDCInterceptStrategy.class);

        private Processor platformMDCProcessor;

        public Processor getPlatformMDCProcessor(){
                return platformMDCProcessor;
        }

        public void setPlatformMDCProcessor(Processor inProcessor){
                this.platformMDCProcessor = inProcessor;
        }

        public Processor wrapProcessorInInterceptors(CamelContext camelContext,
final ProcessorDefinition<?> definition, final Processor target, Processor
nextTarget) throws Exception {
                try{
                        return
                        //new DelegateAsyncProcessor(
                                new Processor() {
                                        public void process(Exchange exchange) 
throws Exception {
                                                try{
                                                        
platformMDCProcessor.process(exchange);
                                                        
target.process(exchange);
                                                } catch (Exception e){
                                                        throw e;
                                                }
                                        }
                                }
                        //)
                        ;
                } catch (Exception e){
                        throw e;
                }
        }
}

route:
<route id="myRoute">
  <wireTap uri="myCustomComponent://..."/>
</route>




--
View this message in context: 
http://camel.465427.n5.nabble.com/interceptStrategies-and-wiretap-tp5730432.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to