My Camel consumer actor won't get unpublished after I sent a message to it. This prevents the application from shutting down. It works if I just start and stop the actor without sending any messages. What am I missing here?
Example code:
import akka.actor.Actor
import Actor._
import akka.event.EventHandler
import akka.camel.{CamelContextManager, CamelServiceManager, Message, Consumer}
object Test {
def main(args: Array[String]): Unit = {
val consumer = actorOf(new Actor with Consumer {
def endpointUri = "direct:test"
def receive = {
case msg: Message => println(msg.bodyAs[String])
}
})
val service = CamelServiceManager.startCamelService
service.awaitEndpointActivation(1) {
consumer.start()
}
// If I comment开发者_C百科 out this row, it works
CamelContextManager.mandatoryTemplate.requestBody("direct:test", "testing")
service.awaitEndpointDeactivation(1) {
consumer.stop()
}
service.stop
}
}
精彩评论