2016-05-31 56 views
0

我是Akka的新用戶,並且正在嘗試使用Camel組件。Akka Camel:沒有終端用戶

我在這裏簡化了代碼,但基本上我有一個Consumer actor,它從JMS端點消耗。

在我的集成測試中,我不希望從JMS消耗。相反,我希望將消息發送到消費者讀取的端點。

因此,我嘗試這種「直接」的方法,但我得到No consumers available on endpoint: Endpoint[direct://myCamelEndpoint]. Exchange[Message: My test message]異常。

我在這裏丟失了什麼配置?

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) 
    } 
} 
+1

使用seda而不是直接,因爲seda的行爲更像JMS。 –

+0

工程魅力!如果你添加這個答案,我會接受它。謝謝 – DJ180

回答

1

使用seda而不是直接,因爲seda的行爲更像JMS。