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

ASF GitHub Bot commented on CAMEL-11250:
----------------------------------------

sermojohn commented on a change in pull request #2123: CAMEL-11250: File name 
pattern and file predicate for poll enrich use.
URL: https://github.com/apache/camel/pull/2123#discussion_r153657525
 
 

 ##########
 File path: 
camel-core/src/main/java/org/apache/camel/processor/PollEnricher.java
 ##########
 @@ -217,6 +220,18 @@ public boolean process(Exchange exchange, AsyncCallback 
callback) {
         Consumer delegate = consumer;
         if (consumer instanceof EventDrivenPollingConsumer) {
             delegate = ((EventDrivenPollingConsumer) 
consumer).getDelegateConsumer();
+
+            if (delegate instanceof GenericFileConsumer) {
 
 Review comment:
   @davsclaus, indeed, as the consumer is shared between many exchanges that 
are poll enriched concurrently.
   
   As I result, I can see no option for implementing the file filtering in the 
GenericFileConsumer.isMatched method as its state belongs to a different 
context. A simple solution is to apply another isMatched check in the 
PollEnricher.process, when the instance of the current exchange is available. 
However this would constitute a enhancement of the PollEnricher  instead of 
reusing an existing method. What do you think?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> File consumer - Allow to specify a header that has the file name to poll
> ------------------------------------------------------------------------
>
>                 Key: CAMEL-11250
>                 URL: https://issues.apache.org/jira/browse/CAMEL-11250
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-core
>            Reporter: Claus Ibsen
>             Fix For: Future
>
>
> See SO
> http://stackoverflow.com/questions/43849165/camel-pollenrich-generating-a-lot-of-timed-waiting-threads
> We can have a FILE_FILTER_NAME header that matches in the 
> org.apache.camel.component.file.GenericFileConsumer#isMatched(org.apache.camel.component.file.GenericFile<T>,
>  boolean, java.util.List<T>)
> so end users can set the header first and then do a pollEnrich with a static 
> endpoint.
> The header can then use equalsIgnoreCase and reguar exp for matching, to make 
> it easier to match files.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to