I am new to Akka
and am attempting to use the Camel
component.
I've simplified the code here, but basically I have a Consumer
actor that consumes from a JMS
endpoint.
In my integration tests, I do not wish to consume from JMS
. Instead, I wish to send messages to an endpoint that my consumer reads from.
Therefore, I am attempting this "direct" approach but I get a No consumers available on endpoint: Endpoint[direct://myCamelEndpoint]. Exchange[Message: My test message]
No consumers available on endpoint: Endpoint[direct://myCamelEndpoint]. Exchange[Message: My test message]
exception.
What configuration am I missing here?
object TestApp extends App {
implicit val system = ActorSystem()
val camel = CamelExtension(system)
val producer = system.actorOf(Props[MyProducer])
val consumer = system.actorOf(Props[MyConsumer])
producer ! "My test message"
}
class MyProducer extends Producer {
override def endpointUri: String = "direct:myCamelEndpoint"
}
class MyConsumer extends Consumer with ActorLogging{
override def endpointUri: String = "direct:myCamelEndpoint"
override def receive: Receive = {
case event: Any => log.info("Received event {}", event)
}
}
使用seda而不是direct,因为seda的行为更像JMS。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.