Instead of pollEnrich you can also just set the body to a constant of
java.io.File which sometimes can be easier

from direct
setBody(constant(new File("somename")))
to http



On Fri, Feb 28, 2014 at 8:17 AM, Claus Ibsen <claus.ib...@gmail.com> wrote:
> Hi
>
> So are you saying you want to call a route with direct, that reads a
> file, and sends the file to a HTTP POST?
>
> If so take a look at the content enricher EIP and the pollEnrich method
> http://camel.apache.org/content-enricher.html
>
> from direct
>   pollEnrich
>    to http
>
>
>
> On Thu, Feb 27, 2014 at 8:18 PM, mister blinky <misterbli...@gmail.com> wrote:
>> If I have a route that i call from other routes (via "direct") that does an
>> HTTP POST. How do I get the file that I want to post into the body of the
>> message before invoking the .to("http://<url>")?
>>
>> The problem I'm facing is that, since every "from" in the route gets started
>> when the route is started, starting this route starts the "direct" as well
>> as the "file" consumer. I don't want to start a file consumer -- I just want
>> to shove the contents of the file i want to POST into the message body of
>> the .to("http://...";).
>>
>>      from("direct:post")
>>           .from("file:<dir>?fileName=<filename>")
>>           .to("http://<url>")
>>      .end();
>>
>> I suppose I could put an inline process that reads a file and sets it to the
>> body of the exchange. But I would think there is a simpler way?
>>
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context: 
>> http://camel.465427.n5.nabble.com/Calling-route-via-direct-that-does-an-HTTP-POST-tp5748043.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>
>
> --
> Claus Ibsen
> -----------------
> Red Hat, Inc.
> Email: cib...@redhat.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
> Make your Camel applications look hawt, try: http://hawt.io



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io

Reply via email to