[ 
https://issues.apache.org/jira/browse/CAMEL-18039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17537256#comment-17537256
 ] 

Karen Lease commented on CAMEL-18039:
-------------------------------------

{quote}At bottom, maybe it would be simple and good to copy properties and 
headers from current exchange to dummy exchange before evaluation?
{quote}
This is not possible due to the architecture of pollEnrich. According to the 
[documentation|https://camel.apache.org/components/3.16.x/eips/pollEnrich-eip.html]:
{quote}pollEnrich uses a Polling Consumer to obtain the additional data.
{quote}
The PollEnricher calls PollingConsumer.receive() to get the data, in your case 
by polling for a file. The receive method does not provide any way to pass an 
Exchange; instead it returns an Exchange representing the event which was 
consumed.
The fileName property on the File endpoint can also be used when "producing" 
files; in this case, the incoming Exchange properties are available.

For this reason, the best solution for your case is to use the expression to 
dynamically create the Consumer endpoint.

> endpoint-dsl - pollEnrich or file consumer polls file alphabetically despite 
> specified fileName
> -----------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-18039
>                 URL: https://issues.apache.org/jira/browse/CAMEL-18039
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core, camel-file
>    Affects Versions: 3.16.0
>            Reporter: Yasser Zamani
>            Priority: Minor
>             Fix For: 3.18.0
>
>
> I have following route
> {code:java}
>     private static final String FILE_PROPERTY_NAME = "MyCsvFileName";
>     private static final String FILE_NAME = "${exchangeProperty." + 
> FILE_PROPERTY_NAME + "}";
>     private static final String FOLDER_NAME = ".";        
> from("direct:MY_CSV").routeId("MY_CSV").
>                 setBody(constant(FIRST_LINE)).
>                 transform(body().append("\r\n")).
>                 
> setProperty(FILE_PROPERTY_NAME).simple("MY_${messageTimestamp}.csv").
>                 to(file(FOLDER_NAME).fileName(FILE_NAME)).
> .
> .
> .
>                 pollEnrich(file(FOLDER_NAME).fileName(FILE_NAME)).
>                 log("The CSV file ${header." + FILE_NAME_ONLY + "} generated. 
> Now uploading it...").
> {code}
> that logs following line
> {quote}The CSV file azurite-blob.sh generated. Now uploading it...
> {quote}
> We eventually realized that pollEnrich or file consumer polls file 
> alphabetically despite specified fileName.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to