You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by nanotech <ra...@gmail.com> on 2013/08/23 17:05:10 UTC

Multiple inputs to an endpoint

Hi,

I have an requirement where I need to send two files as input to a third
party mapping jar. These files are the two arguments that the underlying
mapping jar is expecting. 


Can someone suggest how such a route can be implemented in Camel ?



--
View this message in context: http://camel.465427.n5.nabble.com/Multiple-inputs-to-an-endpoint-tp5737839.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Multiple inputs to an endpoint

Posted by Claus Ibsen <cl...@gmail.com>.
Why do you need a Camel route for that?


On Fri, Aug 23, 2013 at 5:05 PM, nanotech <ra...@gmail.com> wrote:
> Hi,
>
> I have an requirement where I need to send two files as input to a third
> party mapping jar. These files are the two arguments that the underlying
> mapping jar is expecting.
>
>
> Can someone suggest how such a route can be implemented in Camel ?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Multiple-inputs-to-an-endpoint-tp5737839.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Multiple inputs to an endpoint

Posted by Dale King <da...@gmail.com>.
You are fundamentally misunderstanding the way that Camel works. Camel is
built around the concept of an Exchange which is what is passed from one
processor to another. Each link in the chain of a route implements the
Processor interface where it receives an Exchange and modifies it or
possibly produces a new Exchange.

Your mappingURI processor can only receive a single Exchange. It cannot
receive multiple exchanges in one call.

You can certainly pass multiple pieces of data within one exchange using
properties, headers, the body and attachments, but fundamentally the
argument is one exchange.

There are certainly ways to read from 2 files to create 2 different files
creating multiple exchanges and then combining them together into one
exchange that is then passed to the mappingURI processor (e.g. Aggregator,
or content enricher), but if you are not actually doing any processing of
the files in camel it may make more sense to just pass the file names as
parameters to the mappingURI URL.

Once again it is not clear what you really want to accomplish.


On Mon, Aug 26, 2013 at 11:20 AM, nanotech <ra...@gmail.com> wrote:

> I have to take in two files as input because the 3rd party custom mapping
> route is expecting two arguments ( both as byte[] )
>
> So the example would be
>         <route>
>             <from uri="file:input/file1.xml"/>
>             <convertBodyTo type="byte[]"/>
>             <from uri="file:input/file2.xml"/>
>             <convertBodyTo type="byte[]"/>
>             <to uri="mappingURI:MyMappingTranslation"/>
>         </route>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Multiple-inputs-to-an-endpoint-tp5737839p5737983.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Dale King

Re: Multiple inputs to an endpoint

Posted by nanotech <ra...@gmail.com>.
I have to take in two files as input because the 3rd party custom mapping
route is expecting two arguments ( both as byte[] )

So the example would be 
        <route>
            <from uri="file:input/file1.xml"/>
            <convertBodyTo type="byte[]"/>
            <from uri="file:input/file2.xml"/>
            <convertBodyTo type="byte[]"/>           
            <to uri="mappingURI:MyMappingTranslation"/>
        </route>



--
View this message in context: http://camel.465427.n5.nabble.com/Multiple-inputs-to-an-endpoint-tp5737839p5737983.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Multiple inputs to an endpoint

Posted by Dale King <da...@gmail.com>.
You could put the logic to handle the 2 files in an AggregationStrategy
implementation and then depending on which makes more sense use it in an
Aggregator (in the case where you really have 2 routes) or in a content
enricher (where there is a main flow and you are just loading the second
file for that one step.
On Aug 24, 2013 5:35 AM, "nanotech" <ra...@gmail.com> wrote:

> Hi,
>
> I have an requirement where I need to send two files as input to a third
> party mapping jar. These files are the two arguments that the underlying
> mapping jar is expecting.
>
>
> Can someone suggest how such a route can be implemented in Camel ?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Multiple-inputs-to-an-endpoint-tp5737839.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>