0
我有akka camel-ftp
消费者。我想处理代码中的所有异常(例如,身份验证异常,或无法读取ftp上的文件)。我只能看到日志中的堆栈跟踪,无法处理它。 也许最好使用scalaz-camel
。阿卡斯卡拉骆驼。异常处理
此外,我想知道,当所有的文件处理和演员闲置,直到下一次读的FTP文件夹
class FtpWorkerActor() extends Consumer with ActorLogging {
override def receive: Actor.Receive = {
case msg: CamelMessage => /* handle files */
case v: Any => /*never riched. but i need to understand if I have authentification issues etc*/
}
override def endpointUri: String = {
val initDelay = 1000 // 1 second
val otherOptions = s"disconnect=true&throwExceptionOnConnectFailed=true&filter=#datFileFilter&delay=$processingDelay&initialDelay=$initDelay"
s"ftp://[email protected]$ftpSourcePath?username=$username&password=$pass&$otherOptions"
}
}
你好@ sap1ens。谢谢你的答案。我加入'重写VAL supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 2,withinTimeRange = 1分钟){ 情况ν:GenericFileOperationFailedException => log.warning(v.getMessage) 重启 情况下_:异常⇒重启 } '到经理演员。但它不起作用。我可以在日志中看到GenericFileOperationFailedException由骆驼ftp标记为警告(而不是错误)。你能分享一些更多细节吗? –