简体   繁体   中英

No endpoint could be found for: test, please check your classpath contains the needed Camel component jar

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

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM