camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aidatechinc <HFAO...@AIDATECH.COM>
Subject akka camel route shutdown
Date Sun, 15 Feb 2015 20:51:29 GMT
  I am trying to leverage akka to initiate one single camel route execution,
as such once the actor gets a message, it initiates the camel route, and
upon completion, shutdown the route.  Example below, though I am not able to
achieve it.  Either the camel route stays and if I try to shut it down, the
route is never complete.  Any ideas I would appreciate...

class CamelRouteExecutor extends Actor with ActorLogging {

  implicit val system = context.system

  val camel = CamelExtension(system)

  def receive = {

    case work:Any =>

      val route = work.asInstanceOf[java.lang.String]
      log.debug("Executing camel route {}", route)
      val is = new ByteArrayInputStream(route.toString().getBytes())
      val routesDef = camel.context.loadRoutesDefinition(is)
      log.debug("stopping route Id {} from camel context",

      sender() ! Worker.WorkComplete("work status: ")

    case _ =>
      log.warning("got a message, which I don't understand")

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message