I started on a new akka project and having an issue with akka-camel integration testing..
So I have a consumer actor and am trying to test if it is receiving the message I send
Here is the test
@Test
public void testConsumer() {
final String testXml = "<user>" +
"<firstName>First</firstName>" +
"<lastName>Last</lastName>" +
"</user>";
new JavaTestKit(_system) {{
final JavaTestKit probe = new JavaTestKit(_system);
final ActorRef subject2 = _system.actorOf(Consumer.mkProps(probe.getRef(), endPoint, "testConsumerActor"));
camel.template().sendBody(endPoint, testXml);
}};
}
The test fails with the following exception
15:15:02.442 [Camel (test-cdr) thread #0 - seda://testRecords] WARN o.a.c.component.seda.SedaConsumer - Error processing exchange. Exchange[Message: <user><firstName>First</firstName><lastName>Last</lastName></user>]. Caused by: [akka.camel.ActorNotRegisteredException - Actor [akka://test-cdr/user/$a] doesn't exist]
akka.camel.ActorNotRegisteredException: Actor [akka://test-cdr/user/$a] doesn't exist at akka.camel.internal.component.ActorProducer$$anonfun$actorFor$1.apply(ActorComponent.scala:182) ~[akka-camel_2.10-2.2.3.jar:na] at akka.camel.internal.component.ActorProducer$$anonfun$actorFor$1.apply(ActorComponent.scala:182) ~[akka-camel_2.10-2.2.3.jar:na] at scala.Option.getOrElse(Option.scala:120) ~[scala-library-2.10.3.jar:na] at akka.camel.internal.component.ActorProducer.actorFor(ActorComponent.scala:182) ~[akka-camel_2.10-2.2.3.jar:na]
When I debug through my test, I notice that before the constructor for my consumer is called, camel is sending the message. How do I prevent this? or am I missing anything?
SD