Skip to content

Instantly share code, notes, and snippets.

@danbev
Last active December 16, 2015 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danbev/717759ef7a445c626f25 to your computer and use it in GitHub Desktop.
Save danbev/717759ef7a445c626f25 to your computer and use it in GitHub Desktop.
Mobile Gateway Integration

Mobile Gateway

The goal we have is to make it as simple as possible for mobile clients to connect to backend services.

We know the incoming transport protocol which will be HTTP. So we need something that takes these HTTP requests, pass them along to the backend service and returns the result (if any).

Using Apache Camel

Camel has a Servlet component that allows for configuring routes from a specified path. The following image will be used to explain the idea here:

classOptions

The deployment in this case would be a web application archive (war) with the CamelServlet as the reciever of all requests. The path determines which route gets invoked. Even though the diagram above shows a Database system as the backend service, this is only because that is the Camel component used in the example, and that box could be replaced by any Camel component.

For the configuration of routes, the diagram above shows two of Camel's available DSLs.

To try out this idea the following projects have been created:

  1. aerogear-camel
    Contains some classes that were required to get this working on AS7 and also contains a dummy route to demonstrate how provided routes could be added.
  2. aerogear-camel-demo
    Has a dependency to aerogear-camel and adds two routes that use Camel's SQL Component to retrieve data from a database.

"No-Code" configuration

There have been request for a no-code configuration, or as little code as possible, to create the integrations. The XML DSL example is an example of a just providing a xml file to configure a route. This xml file could be generated in any manner and deployed with the war. For example, one could imagine that the xml is generated by a web based GUI and then the deployment assembled and deployed to a server. Though this might look nice in a demo I would hardly think any developers would really use this for anything but just a demo or getting started (but we have scaffolding for getting started).

Security

Currently, Camel has support for Shiro and Spring Security. Security is implemented using a security policy and added to routes using the policy method. To provide a security policy for PicketLink should be possible but we would have to investigate this further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment