0

I am new to Apache Camel, I have requirement to integrate two systems using REST API using Apache camel. I will receive a JSON message on my apache camel rest api endpoint(from source system).This json will contain arrays, I have to extract each array content and post to another external api end point (target). So initially I tried to send incoming message to camel rest api as it is to the target external api endpoint. When I try that, then on application startup I get error.
I searched for similar exception but couldn't find anything concrete as in most of the example, source of message was used as a timer component. Can't we make a call to external rest api end point?

Camel version : 3.4.0 Spring boot : 2.3.1

My router builder code

restConfiguration()
 .component("servlet").port(9090).host("localhost")
 .dataFormatProperty("prettyPrint", "true");

rest().post("/incoming")
      .consumes(MediaType.APPLICATION_JSON_VALUE)
      .produces(MediaType.APPLICATION_JSON_VALUE)
      .route()
      .to("https://webhook.site/ff4a6f68-3b20-4bb2-afa1-c15ccae515ef");

Exception I am getting for target external endpoint

org.apache.camel.NoSuchEndpointException: 
No endpoint could be found for: 
https://webhook.site/ff4a6f68-3b20-4bb2-afa1-c15ccae515ef, 
please check your classpath contains the needed Camel component jar.

Please let me know, where I am making mistake.


Thanks in advance.
Ani

2 Answers 2

3

You don't have camel-http as dependency so add the dependency with correct version

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-http</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>
Sign up to request clarification or add additional context in comments.

Comments

0

Since you are already using camel 3.x you might also want to consider using dynamic endpoint component, in case your destination URL is defined dynamically. For example:

from("direct:login")
  .toD("http:myloginserver:8080/login?userid=${header.userName}");

1 Comment

Dynamic to is required only if your endpoint is computed at runtime. It is not required if the options are.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.