【发布时间】:2014-02-28 04:28:10
【问题描述】:
我开始了一个新的 akka 项目,但遇到了 akka-camel 集成测试的问题..
所以我有一个消费者参与者,我正在尝试测试它是否正在接收我发送的消息
这是测试
@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);
}};
}
测试失败,出现以下异常
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] 不存在 在 akka.camel.internal.component.ActorProducer$$anonfun$actorFor$1.apply(ActorComponent.scala:182) ~[akka-camel_2.10-2.2.3.jar:na] 在 akka.camel.internal.component.ActorProducer$$anonfun$actorFor$1.apply(ActorComponent.scala:182) ~[akka-camel_2.10-2.2.3.jar:na] 在 scala.Option.getOrElse(Option.scala:120) ~[scala-library-2.10.3.jar:na] 在 akka.camel.internal.component.ActorProducer.actorFor(ActorComponent.scala:182) ~[akka-camel_2.10-2.2.3.jar:na]
当我通过测试进行调试时,我注意到在调用我的消费者的构造函数之前,camel 正在发送消息。我该如何防止这种情况?还是我错过了什么?
标清
【问题讨论】:
标签: akka