Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-11683

Allow bean references in to() URI

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: 2.19.1
    • Fix Version/s: None
    • Component/s: camel-core
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      As a workaround to CAMEL-11528, we tried replacing something like

       from("direct:start")
          .wireTap("bean:tap")
          .to("mock:result");
      

      with

      from("direct:start")
          .wiretap("direct:tap")
          .to("mock:result");
      
      from("direct:tap")
          .process("bean:tapper");
      

      We got

      Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route route190 at: >>> process[ref:bean:tapper] <<< in route: Route(route190)[[From[direct:tap]] -> [OnException[[clas... because of No bean could be found in the registry for: bean:tapper of type: org.apache.camel.Processor

      But if we did

      public class MyRoute extends RouteBuilder {
          @Resource Tapper tapper;
      
          public void configure() throws Exception {
              from("direct:start")
                  .wiretap("direct:tap")
                  .to("mock:result");
      
              from("direct:tap")
                  .process(tapper);
          }
      }
      
      @Component
      public class Tapper implements Processor {
          public void Process(Exchange exchange) {}
      }
      

      It worked.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                davsclaus Claus Ibsen
                Reporter:
                keegan Keegan Witt
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: