0

In continuation to the thread "How can Apache Camel be used to monitor file changes?"

I am using camel version 2.23.0, URL looks like

?noop=true&idempotentKey=${file:name}-${file:modified}

But the updated file is still not consumed by camel.

James Z
  • 12,209
  • 10
  • 24
  • 44
Teja
  • 11
  • 3
  • Welcome to stack overflow. To help you better, could you please answer the following? Could you please post the entire endpoint definition( or route)? How do you know it doesn't work? What have you tried so far? How did you update the file? – ShellDragon Feb 06 '19 at 17:39
  • I really don't see any problem with `noop=true&idempotentKey=${file:name}-${file:modified}`. It should work just fine. – ShellDragon Feb 06 '19 at 18:00
  • I am using camel's consumertemplate to consume files from a ftps server. FTPS url looks like ftps://${hostname}:21/folder?username=${username}&password=${password}&binary=true&noop=true&idempotentKey=${file:name}-${file:modified} At the initial run, consumertemplate will pick up all the files at the FTP location, i tried to reupload a file, contents of the file are exactly same, but the file created date is different. During the second run, camel's consumertemplate is not consuming the re-uploaded file. – Teja Feb 06 '19 at 18:23
  • Can you double check on the filesystem to see if the `modified` timestamp changes after you push a new file there? What filesystem is it? How are you sending the file there? Do you have `ssh` access there? – ShellDragon Feb 06 '19 at 20:53
  • I have used winscp to connect to FTP server, verified the file modified timestamp. – Teja Feb 06 '19 at 21:06
  • Do you see it the camel polling consumer polls ftps location regularly? What does the logs say? Perhaps you can enable `DEBUG` logging and/tracing on the route/context to see what is going on in reality. – ShellDragon Feb 06 '19 at 22:14
  • Found this in the TRACE log. [TRACE] - This consumer is idempotent and the file has been consumed before matching idempotentKey: name-modified. Will skip this file: RemoteFile[ABCD.zip]. But when i verified in the winscp, the changed timestamp is clearly modified. – Teja Feb 07 '19 at 03:19
  • Found this in the GenericFileConsumer.class from camel-core - 2.23.0. Based on the idempotentkey, key value is being evaluated as "name-modified" instead of the filename and modification timestamp. String key = file.getAbsoluteFilePath(); if (endpoint.getIdempotentKey() != null) { Exchange dummy = endpoint.createExchange(file); key = endpoint.getIdempotentKey().evaluate(dummy, String.class); } key value is being evaluated as "name-modified" instead of the actual filename and modification date. – Teja Feb 07 '19 at 15:59
  • 1
    Problem resolved by adding simple. ?noop=true&idempotentKey=$simple{file:name}-$simple{file:modified} Thank You ShellDragon for all your inputs. – Teja Feb 07 '19 at 16:41

1 Answers1

1

?noop=true&idempotentKey=$simple{file:name}-$simple{file:modified}

Teja
  • 11
  • 3