I'm trying to run a simple Akka-Camel consumer. I created a server which replies to the address in the uri (in the code example). When I run the code, I get an exception. I'm not sure what i'm doing wrong, do I need to configure Jetty somehow? If so, how?
This Akka sample i'm using as an example and in their example the uri is written in simple string. (https://github.com/akka/akka/tree/master/akka-samples/akka-sample-camel-java)
Exception:
Uncaught error from thread [test-system-akka.actor.default-dispatcher-4] shutting down JVM since 'akka.jvm-exit-on-fatal-error' is enabled for ActorSystem[test-system]
java.lang.NoSuchMethodError: org.apache.camel.util.UnsafeUriCharactersEncoder.encodeHttpURI(Ljava/lang/String;)Ljava/lang/String;
at org.apache.camel.component.jetty.JettyHttpComponent.createEndpoint(JettyHttpComponent.java:169)
at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:91)
at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:461)
at org.apache.camel.util.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:50)
at org.apache.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:186)
...
...
My code:
public static void main(String[] args) {
ActorSystem system = ActorSystem.create("test-system");
ActorRef historyActor = system.actorOf(Props.create(CamelActor.class));
}
public class CamelActor extends UntypedConsumerActor {
private String uri;
public CamelActor() { this.uri = "jetty:http://0.0.0.0:9000/mymain?myparam=true"; }
@Override
public String getEndpointUri() { return uri; }
@Override
public void onReceive(Object message) throws Exception {
if (message instanceof CamelMessage) {
CamelMessage camelMessage = (CamelMessage) message;
System.out.println("==>"+camelMessage.toString());
} else {
unhandled(message);
}
}
}
Thanks,
Guy