Here are the camel route
public void configure() throws Exception {
restConfiguration().component("restlet").host("0.0.0.0").port("9080");
rest().get("/visitor/{name}").to("direct:visitorCheckIn");
from("direct:visitorCheckIn")
.transform().simple("{\"visitorName\":\"${header.name}\"}")
.removeHeaders("*")
.setHeader(Exchange.HTTP_METHOD, constant(org.apache.camel.component.http4.HttpMethods.POST))
.setHeader(Exchange.CONTENT_TYPE, constant("application/json"))
.to("http4://" + visitorServiceAddress + "/visitors/checkIn")
.transform().jsonpath("$.visitorName")
.to("direct:notifyService");
from("direct:notifyService")
.choice()
.when().simple("${body} == \"Alex\"")
.transform().simple("VIP ${body}")
.end()
.setHeader("message").simple("Welcome ${body} to robot world")
.transform().simple("{\"message\":\" ${body} is here.\"}")
.setHeader(Exchange.HTTP_METHOD, constant(org.apache.camel.component.http4.HttpMethods.POST))
.setHeader(Exchange.CONTENT_TYPE, constant("application/json"))
.to("http4://" + notificationServiceAddress + "/notification/notify")
.setBody().simple("${headers.message}")
.removeHeaders("*");
}
guard.py program makes Cozmo turn toward a face and send the requests backend service if it find out the visitor name, and say the welcome words from the service response.
It provides visitor checkin service from the restful service url visitor/checkin, the response message has the visitor checkin time information.
It provides the web interface which could be used for the user to register himself, user can receive the notification, once there is a notification message which is sent to the notification service.
The spring-boot version of camel application, the camel route is defined in CamelRoute.java
The Camel routes which could be used with the camel-k-runtime. You can use mvn exec:java to start up the route.