有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Apache Camel文件队列需要NOOP使用者的目录写入权限?

我在camel中配置了一个简单的NOOP文件使用者,如下所示:

file:///tst?delay=10000&idempotent=false&include=fileMatch&noop=true

通常,运行camel应用程序的用户对/tst没有写入权限,但对/tst/fileMatch有读取和写入权限。不幸的是,我发现camel甚至不会轮询该文件,除非它对/tst有写权限

有办法吗


共 (2) 个答案

  1. # 1 楼答案

    我这么累的时候不应该问问题。这不起作用的原因(as clearly stated in the component description)是默认的readLock策略是markerFile(需要在目录中写入标记文件)。通过将其更改为readLock=fileLock,我不再需要在目录上的写权限来读取文件,因为文件系统锁被放置在正在读取的文件上

    工作URI是:

    file:///tst?delay=10000&idempotent=false&include=fileMatch&noop=true&readLock=fileLock
    
  2. # 2 楼答案

    自上次回答后,camel文件组件发生了相关更改:

    Notice from Camel 2.10 onwards the read locks changed, fileLock and rename will also use a markerFile as well, to ensure not picking up files that may be in process by another Camel consumer running on another node (eg cluster). This is only supported by the file component (not the ftp component).

    因此,在Camel 2.10或更高版本中,您仍然需要写权限才能使用readLock=fileLock。您可以使用readLock=none,其明显的影响是不会有读锁