You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Dragisa Krsmanovic <dk...@plos.org> on 2009/09/15 19:59:49 UTC
pollEnrich doesn't look for FILE_NAME
I am trying to use pollEnrich to add file to message body as described
in http://camel.apache.org/content-enricher.html
Here is full example:
from("direct:start")
.setHeader(Exchange.FILE_NAME, constant("some.file"))
.pollEnrich("file:/test/data?noop=true&readLock=none",10000)
.to("file:/test/ftpdir");
For some reason, pollEnrich doesn't seem to take Exchange.FILE_NAME
header into account and fetches the first available file, not the one
specified in setHeader(...)
Is this a bug ?
--
Dragisa Krsmanovic
Java Developer
Public Library of Science
http://www.plos.org
Re: pollEnrich doesn't look for FILE_NAME
Posted by Dragisa Krsmanovic <dk...@plos.org>.
https://issues.apache.org/activemq/browse/CAMEL-2019
On Wed, 2009-09-16 at 18:06 +0200, Claus Ibsen wrote:
> I actually think you hit a shortcoming of the PollingConsumer API.
> This API does not support supplying options from outside.
> Could you create a JIRA ticket then we can have a look at in how to
> provide such a new feature to this API.
>
> Instead of the pollEnrich you can use a processor/bean etc. where you
> use the consumer template which supports you to dynamic set the
> endpoint URI.
> In which this endpoint URI should contain a fileName option which the
> file you want to read.
>
>
> See more here:
> http://camel.apache.org/polling-consumer.html
>
--
Dragisa Krsmanovic
Java Developer
Public Library of Science
http://www.plos.org
Re: pollEnrich doesn't look for FILE_NAME
Posted by Claus Ibsen <cl...@gmail.com>.
On Wed, Sep 16, 2009 at 5:52 PM, Dragisa Krsmanovic
<dk...@plos.org> wrote:
> On Tue, 2009-09-15 at 22:53 -0700, Fintan Bolton wrote:
>> The first argument to pollEnrich() specifies a consumer endpoint, not a
>> producer endpoint. So, instead of sending the current exchange (the one
>> containing the header) to the endpoint, the pollEnrich() command creates a
>> new exchange object containing one of the files from the specified
>> directory, /test/data. In other words, the current exchange is ignored when
>> pollEnrich() polls the file system, and this is the expected behaviour.
>>
>> If you want to read a specific file, you could use the fileName option
>> option in the URI. For example:
>>
>> .pollEnrich("file:/test/data?noop=true&readLock=none&fileName=foobar.xml",10000)
>>
>> For details of the fileName option, see http://camel.apache.org/file2.html.
>
>
> Is there a way to set file name in pollEnrich dynamically ?
>
> I want something like:
> ...
> .setHeader(Exchange.FILE_NAME).xpath("...")
> .pollEnrich("file:/test/data?noop=true&readLock=none", 10000)
>
I actually think you hit a shortcoming of the PollingConsumer API.
This API does not support supplying options from outside.
Could you create a JIRA ticket then we can have a look at in how to
provide such a new feature to this API.
Instead of the pollEnrich you can use a processor/bean etc. where you
use the consumer template which supports you to dynamic set the
endpoint URI.
In which this endpoint URI should contain a fileName option which the
file you want to read.
See more here:
http://camel.apache.org/polling-consumer.html
> --
> Dragisa Krsmanovic
> Java Developer
> Public Library of Science
> http://www.plos.org
>
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Re: pollEnrich doesn't look for FILE_NAME
Posted by Dragisa Krsmanovic <dk...@plos.org>.
On Tue, 2009-09-15 at 22:53 -0700, Fintan Bolton wrote:
> The first argument to pollEnrich() specifies a consumer endpoint, not a
> producer endpoint. So, instead of sending the current exchange (the one
> containing the header) to the endpoint, the pollEnrich() command creates a
> new exchange object containing one of the files from the specified
> directory, /test/data. In other words, the current exchange is ignored when
> pollEnrich() polls the file system, and this is the expected behaviour.
>
> If you want to read a specific file, you could use the fileName option
> option in the URI. For example:
>
> .pollEnrich("file:/test/data?noop=true&readLock=none&fileName=foobar.xml",10000)
>
> For details of the fileName option, see http://camel.apache.org/file2.html.
Is there a way to set file name in pollEnrich dynamically ?
I want something like:
...
.setHeader(Exchange.FILE_NAME).xpath("...")
.pollEnrich("file:/test/data?noop=true&readLock=none", 10000)
--
Dragisa Krsmanovic
Java Developer
Public Library of Science
http://www.plos.org
Re: pollEnrich doesn't look for FILE_NAME
Posted by Fintan Bolton <fb...@progress.com>.
The first argument to pollEnrich() specifies a consumer endpoint, not a
producer endpoint. So, instead of sending the current exchange (the one
containing the header) to the endpoint, the pollEnrich() command creates a
new exchange object containing one of the files from the specified
directory, /test/data. In other words, the current exchange is ignored when
pollEnrich() polls the file system, and this is the expected behaviour.
If you want to read a specific file, you could use the fileName option
option in the URI. For example:
.pollEnrich("file:/test/data?noop=true&readLock=none&fileName=foobar.xml",10000)
For details of the fileName option, see http://camel.apache.org/file2.html.
--
View this message in context: http://www.nabble.com/pollEnrich-doesn%27t-look-for-FILE_NAME-tp25458854p25466367.html
Sent from the Camel - Users mailing list archive at Nabble.com.