You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by samslara <sa...@yahoo.com> on 2013/04/06 07:50:55 UTC

interceptStrategies and wiretap

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.

Re: interceptStrategies and wiretap

Posted by samslara <sa...@yahoo.com>.
Sorry, forgot to mention that I'm running on ServiceMix 4.3.0 and Camel 2.6.0
using blueprint.



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

Re: interceptStrategies and wiretap

Posted by samslara <sa...@yahoo.com>.
That route wasn't good.  Something more like
<route id="something">
  <from uri="jetty:http://localhost:8080/something" />
  <wireTap uri="myComponent://..." />
</route>



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