0

We are using XML DSL with Akka Camel (2.5.13), and found that when a camel points to a bean, which answers with an Exception, it is not caught by Camel.

Our Scala code:

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

Our Camel route:

<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>

On camel log:

Error starting actor ActorName: actor with the same name is already running akka.actor.InvalidActorNameException: actor name [ActorName] is not unique! 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) 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) at com.app.akka.App$.startChannelByName(SwApp.scala:137) at com.app.akka.actors.management.handleCommand(ManagementReceiver.scala:80) at com.app.akka.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.Actor$class.aroundReceive(Actor.scala:517) at com.app.alla.actors.management.aroundReceive(ManagementReceiver.scala:14) at akka.actor.ActorCell.receiveMessage(ActorCell.scala:588) at akka.actor.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 ERROR org.apache.camel.processor.DefaultErrorHandler Failed delivery for (MessageId: ID-my-pc-1534165894710-0-25 on ExchangeId: ID-my-pc-1534165894710-0-26). Exhausted after delivery attempt: 1 caught: ChannelException(Error starting actor ActorName: actor with the same name is already running, Map(MessageExchangeId -> ID-my-pc-1534165894710-0-26, breadcrumbId -> ID-my-pc-1534165894710-0-26, COMMAND_TYPE -> START_ACTOR, ID_ACTOR -> ActorName))

If I use a bean that just returns an error it works perfectly fine, example:

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

Any idea what's causing this?

Fede E.
  • 2,118
  • 4
  • 23
  • 39
  • The stacktrace error says you have an Akka Actor with the same name already running - so it sounds like a naming clash somewhere in Akka. – Claus Ibsen Aug 13 '18 at 16:05
  • Thanks @ClausIbsen. Yes, correct. The error is caused while trying to create an actor with the name of an existing one. We are trying to catch that exception to proceed accordingly. But for some reason the exception is not being caught, even when sending a basic throwable. – Fede E. Aug 13 '18 at 16:45

0 Answers0