Apache Camel doTry doCatch没有捕获akka camel异常

我们正在使用带有Akka Camel的XML DSL(2.5.13),并发现当一个骆驼指向一个以异常回答的bean时,它不会被Camel捕获 .

我们的Scala代码:

private def replyError(exception: ChannelException) {
    log.error(exception.error)
    sender ! akka.actor.Status.Failure(exception)
}

我们的骆驼路线:

<route id="timer">
    <from uri="timer://test?period=3000&amp;delay=5000&amp;repeatCount=0"/>

    <doTry>

        <to uri="AKKABEAN"/>
        <doCatch>
            <exception>java.lang.Exception</exception>

            <log message="**********************************EXCEPTION HANDLED*******************************"/>

        </doCatch>
    </doTry>

</route>

在骆驼日志:

启动actor ActorName时出错:具有相同名称的actor已经在运行akka.actor.InvalidActorNameException:actor名称[ActorName]不是唯一的! at akka.actor.dungeon.ChildrenContainer $ NormalChildrenContainer.reserve(ChildrenContainer.scala:129)at akka.actor.dungeon.Children $ class.reserveChild(Children.scala:134)at akka.actor.ActorCell.reserveChild(ActorCell.scala) :431)at akka.actor.dungeon.Children $ class.makeChild(Children.scala:272)akka.actor.dungeon.Children $ class.attachChild(Children.scala:48)at akka.actor.ActorCell.attachChild( ActorCell.scala:431)位于com.app.akka.App $ .createActor的com.app.akka.App $ .createChannelActor(SwApp.scala:233)的akka.actor.ActorSystemImpl.actorOf(ActorSystem.scala:734) (swApp.scala:199)位于com.app.ak.App上的com.app.akka.App $ .startChannelByName(SwApp.scala:137)com.app.akka.actors.management.handleCommand(ManagementReceiver.scala:80) .actors.management.manageChannel(ManagementReceiver.scala:66)at com.app.akka.actors.management.ManagementReceiver $$ anonfun $ receive $ 1.applyOrElse(ManagementReceiver.scala:52)at scala.PartialFunction $ AndThen.applyOrElse(PartialFunction) .scala:189)at akka.actor.A ctor $ class.aroundReceive(Actor.scala:517)位于akka.actor的akka.actor.ActorCell.receiveMessage(ActorCell.scala:588)的com.app.alla.actors.management.aroundReceive(ManagementReceiver.scala:14) .ActorCell.invoke(ActorCell.scala:557)at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:258)at akka.dispatch.Mailbox.run(Mailbox.scala:225)at akka.dispatch.Mailbox.exec( Mailbox.scala:235)at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)at akka.dispatch.forkjoin.ForkJoinPool $ WorkQueue.runTask(ForkJoinPool.java:1339)at akka.dispatch.forkjoin.ForkJoinPool .runWorker(ForkJoinPool.java:1979)at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)2018-08-13 10:11:45,807错误org.apache.camel.processor.DefaultErrorHandler交付失败( MessageId:IDI-my-pc-1534165894710-0-25 on ExchangeId:ID-my-pc-1534165894710-0-26) . 交付尝试后用尽:1捕获:ChannelException(错误启动actor ActorName:具有相同名称的actor已在运行,Map(MessageExchangeId - > ID-my-pc-1534165894710-0-26,breadcrumbId - > ID-my-pc- 1534165894710-0-26,COMMAND_TYPE - > START_ACTOR,ID_ACTOR - > ActorName))

如果我使用只返回错误的bean,它的工作完全正常,例如:

<bean id="forced" class="java.lang.Exception">
    <constructor-arg index="0" value="This is forced"/>
</bean>

知道是什么导致了这个吗?

回答(0)