You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2026/07/22 06:52:00 UTC
[jira] [Commented] (CAMEL-24231) pollEnrich with dynamic fileName using exchangeProperty fails due to missing properties in dummy exchange
[ https://issues.apache.org/jira/browse/CAMEL-24231?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18098059#comment-18098059 ]
Claus Ibsen commented on CAMEL-24231:
-------------------------------------
Fixed via https://github.com/apache/camel/pull/24994
> pollEnrich with dynamic fileName using exchangeProperty fails due to missing properties in dummy exchange
> ---------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-24231
> URL: https://issues.apache.org/jira/browse/CAMEL-24231
> Project: Camel
> Issue Type: Bug
> Components: camel-file
> Reporter: Claus Ibsen
> Assignee: Claus Ibsen
> Priority: Minor
> Fix For: 4.22.0
>
>
> When using pollEnrich with a dynamic fileName expression that references exchange properties (e.g. {{${exchangeProperty.target}}}), the PollDynamicAware optimization creates a dummy exchange via {{GenericFileHelper.createDummy()}} that does not copy exchange properties from the incoming exchange. This causes the fileName expression to evaluate to null, effectively bypassing the filename filter and picking up any file in the directory.
> The workaround is to set {{allowOptimisedComponents(false)}} on the pollEnrich.
> *Root cause:*
> {{GenericFileHelper.createDummy()}} copies headers and variables from the dynamic exchange but misses exchange properties. A secondary issue is that the variables copy is nested inside the {{hasHeaders()}} guard, so variables are not copied when the exchange has variables but no headers.
> *Example route:*
> {code:java}
> from("direct:start")
> .pollEnrich().simple("file:inbox?noop=true&fileName=${exchangeProperty.target}")
> .timeout(500)
> .to("mock:result");
> {code}
> *Fix:*
> Copy exchange properties (and fix variables nesting) in {{GenericFileHelper.createDummy()}}.
> Reported by Marcus Ionker on the Camel users mailing list.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)