I am trying to send and receive messages using akka-camel
and created a sample example for producer and consumer like below :
Producer:
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"
}
Consumer:
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])
}
But I am facing issue in both producer and consumer like below. What I am missing?
Producer:
java.lang.IllegalArgumentException: destination must be specified
Consumer :
Caused by: org.apache.camel.NoSuchEndpointException: No endpoint could be found for: test, please check your classpath contains the needed Camel component jar.
I believe you need to provide a name to the test mock endpoint, just test
might not work. Can you try doing doing test:myMockEndpoint
?
You can take a look here: http://camel.apache.org/components.html