camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Savitsky (JIRA)" <>
Subject [jira] [Created] (CAMEL-8646) Camel doesn't allow intercept and advice on the same route
Date Thu, 16 Apr 2015 14:02:58 GMT
Alex Savitsky created CAMEL-8646:

             Summary: Camel doesn't allow intercept and advice on the same route
                 Key: CAMEL-8646
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 2.15.0
            Reporter: Alex Savitsky

Let's assume we have a route, defined in a RouteBuilder. It allows us to define an interceptor
that would be executed before every route step, via an intercept(Processor) call.

Routes can also have an advice attached to them, via RouteDefinition.adviceWith(AdviceWithRouteBuilder)

If these two methods of weaving custom processing into existing routes are combined, Camel
throws an exception:

Exception in thread "main" java.lang.IllegalArgumentException: There are no outputs which
matches: * in the route: Route(main)[[From[direct:main]] -> [Intercept[[process[Processor@0x4b416926]]],
Log[Main ${body} ${headers}]]]
	at org.apache.camel.builder.AdviceWithTasks$3.task(
	at org.apache.camel.model.RouteDefinition.adviceWith(
	at camel.Test.main(

Simple test to illustrate the issue:

public class Test {
	public static void main(String[] args) throws Exception {
		ModelCamelContext context = new DefaultCamelContext();
		RouteBuilder route = new RouteBuilder() {
			public void configure() throws Exception {
				from("direct:advice").log("Advice ${body} ${headers}");
				from("direct:main").routeId("main").log("Main ${body} ${headers}");
		route.intercept().process(new Processor() {
			public void process(Exchange exchange) throws Exception {
				System.out.println("Intercept " + exchange);
		context.getRouteDefinition("main").adviceWith(context, new AdviceWithRouteBuilder() {
			public void configure() throws Exception {
		context.createProducerTemplate().sendBody("direct:main", "testBody");

This message was sent by Atlassian JIRA

View raw message