我试图使用akka-camel发送和接收消息,并为生产者和消费者创建了一个示例示例,如下所示:
制片人:
import akka.actor.{Actor, ActorSystem, Props}
import akka.camel.Producer
class CamelJmsProducer extends Actor with Producer {
override def endpointUri = "test"
}
object CamelJmsProducerApp extends App {
val system = ActorSystem("some-system")
val ref = system.actorOf(Props[CamelJmsProducer])
ref ! "HEY"
}消费者:
import akka.actor.{Actor, ActorSystem, Props}
import akka.camel.{CamelMessage, Consumer}
class CamelJmsConsumer extends Actor with Consumer {
override def receive = {
case msg: CamelMessage ⇒ println("RECEIVED >>> " + msg)
case _ ⇒ println("RECEIVED NOTHING>>> ")
}
override def endpointUri = "test"
}
object CamelJmsConsumerApp extends App {
val system = ActorSystem("some-system1")
system.actorOf(Props[CamelJmsConsumer])
}但我面临的问题,在生产者和消费者,如下所示。我错过了什么?
制片人:
java.lang.IllegalArgumentException:必须指定目标
消费者:
由: org.apache.camel.NoSuchEndpointException:无法找到用于: test的端点,请检查您的类路径包含所需的骆驼组件jar。
发布于 2017-12-07 09:08:25
我相信您需要为测试模拟端点提供一个名称,只是test可能无法工作。你能试着做test:myMockEndpoint吗?
你可以在这里看看:http://camel.apache.org/components.html
https://stackoverflow.com/questions/47690868
复制相似问题