This series of blog is based on building an auto dealership management system on Fuse Integration Service. We will be creating three major functions in the system.
We will be exporting a sales report to a web page, provide current inventory status of available cars through web service. And collect customer data from IoT devices on their car then alert close by shops. It would be better if you have some basic knowledge of Apache Camel before you begin, because I will not explain it in a great detail, I'll put my focus on how it works with the base platform, OpenShift. For Camel basic, you can check out my previous JBoss Fuse workshop.
Part three of this series is the Customer IoT Service, here we have an application that will act as multiple cars constantly and random sending GPS location signal through restful endpoint and here we take the signal and see how close is this location to the dealer store. Step one is when we get the signal, we want to store it and pass it along to a medium and process the input data more efficiently.
There are two endpoint for this service, web service and messaging broker. Webservice we have done it several times now, simple expose the port in the docker by setting the http port in docker maven plugin,
and configure the service in pom.xml for fabric8 plugin to pick up.
Normally, to setup broker, we need to specify the IP and port of the broker, this will cause problems on cloud. The characteristic of cloud is it's flexibility and freedom of adding and removing resource according to need, therefore it's not possible to pre-configure the broker that maybe available or could suddenly removed by upcoming incidents. That's why by take advantage of using the existing broker service we have already setup on Openshift, and using the fabric8 amq component, it will hide the complexity of the network setting, and auto discover where the broker is for you. If you take a look at the service list in OpenShift service console,
Here, you can see the amq default protocol. We will be using this one, set the service name in the system environment variable inside pom.xml
In our Camel Context, we want to configure the "io.fabric8.mq.core.MQConnectionFactory" and provide our ID and PWD.
<bean id="amqConnectionFactory" class="io.fabric8.mq.core.MQConnectionFactory">
<property name="userName" value="yyyy"/>
<property name="password" value="xxxx"/>
After these configuration, we can start build our Camel route. What we do it simply place the incoming parameter into a messaging queue called "TESTQUEUE", and return a Done constant text to client sending the location.
<restConfiguration component="jetty" port="9191" />
<to pattern="InOnly" uri="amq:queue:TESTQUEUE"/>
Deploy the application as in part one and two by this command.
- mvn -Pf8-local-deploy
In the console, you can find the gpsservice is up and running,
Test the application by running the restful endpoint,
In the application console, we see the route is active,
and in the broker console, we can see the message in broker.