简体   繁体   English

Apache Camel 文件队列需要 NOOP 消费者的目录写入权限?

[英]Apache Camel File Queue Requires Directory Write Permissions For NOOP Consumer?

I have a simple NOOP file consumer configured in camel as follows:我在骆驼中配置了一个简单的 NOOP 文件使用者,如下所示:

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

Normally the user running the camel application will not have write permissions to /tst, however does have read and write permissions to /tst/fileMatch.通常,运行骆驼应用程序的用户将没有对 /tst 的写权限,但对 /tst/fileMatch 有读写权限。 Unfortunately I'm finding that camel won't even poll for the file unless it has write permissions to /tst.不幸的是,我发现骆驼甚至不会轮询该文件,除非它对 /tst 具有写权限。

Is there a way around this?有没有解决的办法?

Since the last answer, the camel file component had a relevant change:自上次回答以来,骆驼文件组件发生了相关变化:

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).请注意,从 Camel 2.10 开始,读锁发生了变化, fileLock和 rename 也将使用 markerFile ,以确保不会拾取运行在另一个节点(例如集群)上的另一个 Camel 消费者可能正在处理的文件。 This is only supported by the file component (not the ftp component).这仅受文件组件支持(不支持 ftp 组件)。

Hence, in Camel 2.10 or above, you still need write permission to use readLock=fileLock.因此,在 Camel 2.10 或更高版本中,您仍然需要写入权限才能使用 readLock=fileLock。 You can use readLock=none , with the obvious impact that there will not be a read lock.您可以使用readLock=none ,明显的影响是不会有读锁。

I shouldn't ask questions when I'm this tired.当我这么累的时候,我不应该问问题。 The reason that this doesn't work ( as clearly stated in the component description ) is that the default readLock strategy is markerFile (which needs to write the marker file in the directory).这不起作用的原因(在组件描述中明确说明)是默认的readLock策略是markerFile (需要在目录中写入标记文件)。 By changing this to readLock=fileLock I no longer need write permissions on the directory to read the file as the file system lock is placed on the file being read.通过将其更改为readLock=fileLock ,我不再需要目录的写权限来读取文件,因为文件系统锁被放置在正在读取的文件上。

The working URI is:工作 URI 是:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM