2017-03-29 1 views
0

나는 다음과 같이 낙타가 구성 요소 파일 사용하여 파일을 소모하고있다. Camel File documentation은 기본적으로 읽기 잠금을 사용하지 않을 것이라고 말합니다.낙타는 파일에 암시 적 읽기 잠금을 사용합니까?</p> <pre><code><from uri="file:myDir?noop=true&amp;filter=myFilter&amp;scheduler=quartz2&amp;scheduler.cron={{schedule}}/> </code></pre> <p>소스 위치가 읽기 전용 :

그러나이 코드를 실행하는 동안 예외가 거부되었습니다.

엔드 포인트 [파일 : //의 myFile 필터링 = myFilter & 나무 등 = 사실 & 무 조작 = 사실 & 스케줄러 = quartz2 & scheduler.cron = {{mySchedule}} 처리 파일을 시작할 수 없습니다 : GenericFile를 [MYDIR \의 myFile ]로 인해 : 액세스가 거부되었습니다. 에 의한 : java.io.IOException 상위 - 액세스가 거부]

스택 추적 때 java.io.IOException : java.io.UnixFileSystem.createFileExclusively (기본 방법)에 권한이 거부 [: 1.8.0_66] 자바에서 .io.File.createNewFile (File.java:1012) [: 1.8.0_66] at org.apache.camel.util.FileUtil.createNewFile (FileUtil.java:587) [org.apache.camel : camel-core : 2.15.1.redhat-621,090 com.googlecode.concurrentlinkedhashmap : concurrentlinkedhashmap-LRU : org.apache.camel.component.file.strategy.MarkerFileExclusiveReadLockStrategy.acquireExclusiveReadLock (MarkerFileExclusiveReadLockStrategy.java:71)에 1.4.2] [조직도. apache.camel : camel-core : 2.15.1.redhat-621090 com.googlecode.concurrentlinked hashmap : concurrentlinkedhashmap-lru : 1.4.2] 에서 org.apache.camel.component.file.strategy.GenericFileProcessStrategySupport.begin (GenericFileProcessStrategySupport.java:49) [org.apache.camel : camel-core : 2.15.1. 레드햇 621,090 com.googlecode.concurrentlinkedhashmap을 : concurrentlinkedhashmap-LRU : 1.4.2] org.apache.camel.component.file.strategy.GenericFileRenameProcessStrategy.begin (GenericFileRenameProcessStrategy.java:35)를 org.apache.camel에서 : 낙 코어 : 2.15.1.redhat-621,090 com.googlecode.concurrentlinkedhashmap : concurrentlinkedhashmap-LRU : org.apache.camel.component.file.GenericFileConsumer.processExchange (GenericFileConsumer.java:352)에 1.4.2] [ org.apache.camel : camel-core : 2.15.1.redhat-621090 com.googlecode.concur rentlinkedhashmap : concurrentlinkedhashmap-lru : 1.4.2] at org.apache.camel.component.file.GenericFileConsumer.processBatch (GenericFileConsumer.java:211) [org.apache.camel : camel-core : 2.15.1.redhat- 621090 com.googlecode.concurrentlinkedhashmap : concurrentlinkedhashmap-lru : 1.4.2] at org.apache.camel.component.file.GenericFileConsumer.poll (GenericFileConsumer.java:175) [org.apache.camel : camel-core : 2.15.1.redhat-621090 com.googlecode.concurrentlinkedhashmap : concurrentlinkedhashmap-lru : 1.4.2] at org.apache.camel.impl.ScheduledPollConsumer.doRun (ScheduledPollConsumer.java:174) [org.apache.camel : 낙타 - 코어 : 2.15.1.redhat-621090 com.googlecode.concurrentlinkedhashmap : concurrentlinkedhashmap-lru : 1.4.2] at org.apache.camel.impl.ScheduledPollConsumer.run (ScheduledPollConsumer.java:101) [org.apache.camel : camel-core : 2.15.1.redhat-621090 com.googlecode.concurrentlinkedhashmap : concurrentlinkedhashmap-lru : 1.4.2 org.apache.camel.pollconsumer.quartz2.QuartzScheduledPollConsumerJob.execute (QuartzScheduledPollConsumerJob.java:59)에서] [org.apache.camel : 낙타 quartz2 : 2.15.1.redhat-621,090] 에서 조직을 .quartz.core.JobRunShell.run (JobRunShell.java:202) [org.석영 스케줄러 석영 2.2.1] org.quartz.simpl.SimpleThreadPool $ WorkerThread.run (SimpleThreadPool.java:573) org.quartz 스케쥴러에서 석영 2.2.1]

스택 추적에서 낙타가 읽기 잠금을 만들려고하고 있으며 권한이 부족하여 예외가 발생하고있는 것으로 보입니다. 낙타는 잠금을 사용하는 이유는

그래서, 내 질문은 읽기 잠금의 기본값은 내가 읽기에서 파일을 소비 할 수있는 방법이이 동작을 예상되는 경우 없음

  • , 경우에도

    • 입니다 쓰기 권한이없는 유일한 위치?

    UPDATE 대답 중 하나를 제안하지만, 그래도 문제가 해결되지 않았다 나는이 falsereadLockMarkingFile을 설정하려고

    . 따라서 readLocknone으로 명시 적으로 설정했습니다. 이제는 효과가 있습니다. 모르겠다. 이유는 readLock이 설명서에 언급 된대로 기본값으로 none이 아니기 때문입니다.

  • 답변

    2

    readLock-option은 camel이 파일에 독점 읽기 잠금을 획득하려고 시도하는지 여부 만 결정합니다. "readLockMarkerFile"이라는 또 다른 옵션이 있는데, 기본값은 true이고, 그 옵션을 false로 설정하면 괜찮을 것입니다.

    <from uri="file:myDir?noop=true&amp;filter=myFilter&amp;scheduler=quartz2&amp;scheduler.cron={{schedule}}&amp;readLockMarkerFile=false/> 
    
    +0

    readLockMarkerFile을 false로 설정하려고했습니다. 하지만 그건 효과가 없었습니다. 그런 다음 명시 적으로 readLock = none으로 설정해 보았습니다. 이 경우 낙타가 readLock 이름 바꾸기를 사용하고 있지만 그 이유는 알 수 없습니다. – niyasc

    0

    이 질문에 대한 직접적인 대답은 아니지만 파일 감시자가 찾는 트리거 파일 (0 바이트)을 사용했습니다. 그런 다음 경로는 트리거가 동반자 인 실제 파일에서 작동합니다. 트리거 파일은 /parent/camel 하위 디렉토리로 이동되므로 다시 처리되지 않습니다. 라우트를 실행하는 둘 이상의 서버가있는 분산 환경에서 실제 파일을 '선택'하려고합니다.

    관련 문제

     관련 문제