2 Replies Latest reply on May 2, 2012 1:15 PM by simplex-software

    The "direct" component: how does it work ?

    simplex-software

      Greetings,

       

      Trying to figure out how does the direct component work. Reading the documentation it gives this example:

       

      from("activemq:queue:order.in")

          .to("bean:orderServer?method=validate")

          .to("direct:processOrder");

       

      from("direct:processOrder")

          .to("bean:orderService?method=process")

          .to("activemq:queue:order.out");

       

      Based on the understanding I get from this example, I would expect that the following works as well:

       

            from("file:{{product.file.inbox}}").to("direct:products-variants");

            from("file:{{variant.file.inbox}}").to("direct:products-variants");

            from("direct:product-variants").log("### We received: $(body)");

       

      What I would expect is to log the content of the files. Or even:

       

            from("file:{{product.file.inbox}}").to("direct:products-variants");

            from("file:{{variant.file.inbox}}").to("direct:products-variants");

            from("direct:product-variants").to("file:{{product.variant.file.outbox}}?fileExist=Append");

       

      to append the files. But none of previous routes work. Is that expected or am I doing an error ?

       

      Many thanks in advance,

       

      Nicolas

        • 1. Re: The "direct" component: how does it work ?
          davsclaus

          Yes its just a like a direct method invocation. Or as if you concat the routes together.

           

          And what do you mean by not working?

          • 2. Re: The "direct" component: how does it work ?
            simplex-software

            Okay so its supposed to work. In my tests it didn't seem to work as it didn't write neither on the JMS output destination nore in the output file. But I'm deplying on Karaf and, working with files with absolute path seems to be tricky, especially on Windows. For example, file://D: is sometimes relative to the Karaf root directory despite the "D:". Otherwise it correctly refers the right location depending on conditions that I didn't yet clarify. So it might be that it worked but I didn't notice it. Many thanks for the answer.

             

            Kind regards,

             

            Nicolas