Montag, 6. Februar 2012

Apache Camel flight aggregation mashup

For the master course system integration at FH-Brandenburg it should be developed a flight data
mashup using Apache Camel's enterprise integration pattern (EIP).

The task:
1. Get current flight information data from
2. Send email in case of emergency code (squawk code)
3. Find out the country on current plane position
4. Execute the following steps in parallel when plane is in Germany, Switzerland or Austria
4.1 Get weather information on plane position
4.2 Search destination airport for plane
4.3 Search points of interests on plane position
5. Make aggregated information in a RSS feed available for each country

The solution:
The project was split into two parts. Each part has its own Route Builder. In the first part there is the
RSS file producer and in the second part the RSS file consumer. The RSS file producer (Image 1)
gets the flights, enriches the flights with additional information and saves the results in country
specific RSS files. In case of emergency code it sends a notification mail. The RSS file consumer
handles browser requests on port 9000. If the user enters the correct URL (like localhost:9000/rss-
feed/DE, localhost:9000/rss-feed/CH or localhost:9000/rss-feed/AT) the RSS file consumer delivers
the country specific RSS file.

Details of RSS file producer

Image 1: RSS file producer

The RSS file producer is a polling consumer, which fetches the flight information as JSON format
from every 10 minutes. Because of all flights are in a
single message, it is a good advice to split it into single messages, which may be processed by
Camel on its own. In the next step the input body of the exchange object is converted into a Plain
Old Java Object (POJO). The POJO has additional properties for country of current plane position,
weather, POIs around plane position and destination airport information. Now the messages was
sent to two recipient channels. In the Emergency Channel a Content Based Router routes the
messages either to a mail processor if there is an emergency code or to the purger. In the Process
Channel the flight messages were enriched with country information. After all, messages with non
German speaking countries were filtered out and the messages were sent to three recipient channels.
The execution of the messages in this three channels is simultaneous. In this channels the messages
were enriched with weather, POI and destination airport information and afterward sent to an
Aggregation Channel. In the Aggregation Channel three messages with same flight number were
aggregated to one message. Finally the messages were transformed to RSS feeds and saved in
country specific RSS files by appending.

Used APIs:
Google Geocoding API for country information
Free local waether API from WorldWeatherOnline for weather information
Destination airport information from
Google Places API for POIs

Details of RSS file consumer

Image 2: RSS file consumer

The RSS file consumer consists of a Camel CXFRS Component  that hosts a RESTful HTTP service which handles incoming HTTP requests. The output body of the request (response) will be enriched with the requested country specific RSS file and sent back to the browser.

Source Code

The full source code is available under
Note: The keys for WorldWeatherOnline and Google Places have to be removed.

1 Kommentar: