1

Problem: The file is not consumed from the server

I am using

from("test")
    .routeId("test")
    .pollEnrich()
    .simple("smb://myUrl?password=test&fileName=${in.headers.test}")
    .aggregationStrategy((Exchange oldExchange, Exchange newExchange) -> {
      //do things
      return newExchange;
    })

I have no error, I am sure that the url is ok, because when I am using the same url in the from(), the file gets consumed. I don't understand what is happening here, I am using camel 2.24.0 and camel-extra:camel-jcifs:2.23.1. I have tried to use smb2 using the library from github.jborza.camel-smbj, still the same outcome.

I tried to debug, I can see in the GenericFileComponent class in the createEndpoint method, that the endpoint is correctly created, then I tried (in debug mode) to get the exchanges from my endpoint, I can get them successfully, further this will be a SmbEndpoint, when I try to get the exchanges from my smbEndpoint it returns exactly the needed file from the server, further a EventDrivenPollingConsumer is created for this endpoint, I had a look at it, is started (seems ok). When it hits the consumer.receive() from the PollEnricher it blocks, no file is consumed. I tried using a timeout, than returns null, so somehow cannot find the file, or the consumer is wrong, I honestly have no clue at this point.

I had a look here too: https://github.com/apache/camel/blob/b9a3117f19dd19abd2ea8b789c42c3e86fe4c488/core/camel-core/src/test/java/org/apache/camel/component/file/FileConsumePollEnrichFileTest.java and I have played with delays &consumer.initialDelay=100&consumer.delay=100&consumer.bridgeErrorHandler=true

Then I tried to implement with processor like here:

https://github.com/apache/camel/blob/b9a3117f19dd19abd2ea8b789c42c3e86fe4c488/core/camel-core/src/test/java/org/apache/camel/component/file/FileConsumePollEnrichFileUsingProcessorTest.java

The same result :(

At some point the file was consumed, suddenly, but this happened only once, I cannot understand this behavior.

agata
  • 481
  • 2
  • 9
  • 29
  • 1
    I'm having the exact same problem. Have found an answer ? – Patrice Sep 15 '20 at 16:01
  • Honestly I don’t remember what I did, as far as I remember my url became very long, because I added some properties. – agata Sep 16 '20 at 05:44
  • Thanks for your quick feedback. Replacing pollenrich by enrich eventually worked for me, except that the option "delete=true" is not working (file is not deleted). I endedup developping my own SmbProcessor that fetches the file and delete it. – Patrice Sep 16 '20 at 10:05
  • Great! Take into account that the smb library is not maintained anymore and you should think to migrate to something else – agata Sep 16 '20 at 10:09

1 Answers1

0

Sounds that you have a readlock problem, can you find any files in .done with the same name as the file you try to consume?

anpt
  • 90
  • 8