0

我们将 XML DSL 与 Akka Camel (2.5.13) 一起使用,发现当骆驼指向一个 bean 时,该 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>

在骆驼日志上:

启动演员 ActorName 时出错:具有相同名称的演员已经在运行 akka.actor.InvalidActorNameException:演员名称 [ActorName] 不是唯一的!在 akka.actor.dungeon.ChildrenContainer$NormalChildrenContainer.reserve(ChildrenContainer.scala:129) 在 akka.actor.dungeon.Children$class.reserveChild(Children.scala:134) 在 akka.actor.ActorCell.reserveChild(ActorCell.scala :431) at akka.actor.dungeon.Children$class.makeChild(Children.scala:27​​2) at akka.actor.dungeon.Children$class.attachChild(Children.scala:48) at akka.actor.ActorCell.attachChild( ActorCell.scala:431) at akka.actor.ActorSystemImpl.actorOf(ActorSystem.scala:734) at com.app.akka.App$.createChannelActor(SwApp.scala:233) at com.app.akka.App$.createActor (SwApp.scala:199) 在 com.app.akka.App$.startChannelByName(SwApp.scala:137) 在 com.app.akka.actors.management。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:ExchangeId 上的 ID-my-pc-1534165894710-0-25:ID-my-pc-1534165894710-0-26)传递失败。交付尝试后耗尽:1 捕获:ChannelException(错误启动演员 ActorName:同名演员已经在运行,Map(MessageExchangeId -> ID-my-pc-1534165894710-0-26,breadcrumbId -> ID-my-pc- 1534165894710-0-26, COMMAND_TYPE -> START_ACTOR, ID_ACTOR -> ActorName)) 运行(ForkJoinWorkerThread.java:107)2018-08-13 10:11:45,807 错误 org.apache.camel.processor.DefaultErrorHandler 传递失败(MessageId:ID-my-pc-1534165894710-0-25 on ExchangeId:ID-我的 PC-1534165894710-0-26)。交付尝试后耗尽:1 捕获:ChannelException(错误启动演员 ActorName:同名演员已经在运行,Map(MessageExchangeId -> ID-my-pc-1534165894710-0-26,breadcrumbId -> ID-my-pc- 1534165894710-0-26, COMMAND_TYPE -> START_ACTOR, ID_ACTOR -> ActorName)) 运行(ForkJoinWorkerThread.java:107)2018-08-13 10:11:45,807 错误 org.apache.camel.processor.DefaultErrorHandler 传递失败(MessageId:ID-my-pc-1534165894710-0-25 on ExchangeId:ID-我的 PC-1534165894710-0-26)。交付尝试后耗尽:1 捕获:ChannelException(错误启动演员 ActorName:同名演员已经在运行,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>

知道是什么原因造成的吗?

4

0 回答 0