The Platform HTTP is used to allow Camel to use the existing HTTP server from the rumtime
for information on Platform HTTP component please go through the below link https://camel.apache.org/components/3.7.x/platform-http-component.html
Lets do a simple POC on with Camel Platform http application through JAVA DSL.
camel quarkus dependencies to support platform http component to be added in pom.xml
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-platform-http</artifactId>
</dependency>
Lets create a simple route builder class as below
FromHttpToLogEndpointRouteBuilder.java
package org.brktech.routebuilder;
import java.util.Date;
import javax.enterprise.context.ApplicationScoped;
import org.apache.camel.builder.endpoint.EndpointRouteBuilder;
@ApplicationScoped
public class FromHttpToLogEndpointRouteBuilder extends EndpointRouteBuilder {
@Override
public void configure() throws Exception {
from(platformHttp("/brktech/access/endpoint")).setBody()
.simple("Hello world I am bharani Ravi kanth, Learning Camel integration with quarkus")
.log("http url invoked at :: " + new Date());
}
}
whenever there is hit to the url path "/brktech/access/endpoint", a text "Hello world I am bharani Ravi kanth, Learning Camel integration with quarkus" responds back to the browser.
application.properties
quarkus.http.port=8282
Overriding the default port 8080 to 8282
lets run the application in eclipse under quarkus dev mode (compile quarkus:dev)
We can see the application started and listening to the path "platform-http:///brktech/access/endpoint" through the port 8282
On hitting the path "http://localhost:8282/brktech/access/endpoint" we get the response as below through the browser
The above POC source code is available through my git hub repository https://github.com/bharaniravikanth/camel-quarkus-brk-tech-repo/tree/main/camel-quarkus-integration/camel-platform-http-quarkus-poc
Note: Its a private repository