Search code examples
apache-camelspring-camel

How can I write Spring XML about multiple inputs


I am implementing mediation module. This system sends many files to target systems with adding some information.

There are many input sources and output targets. So, I want to write Spring XML for this process. But I cannot find this solution.

I saw some articles in Jboss community.

https://access.redhat.com/documentation/en-us/red_hat_jboss_fuse/6.3/html/apache_camel_development_guide/basicprinciples-multipleinputs

In this article, there is below definition of java dsl.

from("URI1").to("DestinationUri");
from("URI2").to("DestinationUri");
from("URI3").to("DestinationUri");

Is this code possible in springXML? Please check my question and reply solution.

Thank you.


Solution

  • You should only have 1 from per route. Having 2+ is deprecated and not recommended. And in Camel 3 we have restricted this to exactly 1 input only.

    So use 1 route per input. You can link multiple routes together via direct if you want to call something that is shared among those routes

    from a
      to direct:shared
    
    from b
      to direct:shared
    
    from direct:shared
      to foo