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://$username@$ftpSourcePath?username=$username&password=$pass&$otherOptions"
  }
}
4

1 に答える 1

0

スーパーバイザ内でアクタを実行し、そこでエラー処理を実装するようにしてください。これに関するその他のドキュメントは次のとおりです。http://doc.akka.io/docs/akka/current/scala/fault-tolerance.html

FtpWorkerActorこの場合、スーパーバイザーはすべての例外をキャッチし、停止、再起動などの処理を決定できます。

于 2016-05-23T16:06:08.377 に答える