AeroGear Camel/SwitchYard Integration
There have been inquiries about how existing services could be exposed using AeroGear Controller, and this document will try to sort out why someone would want to do this, and also try to come up with some possible solutions.
Why would you want to do this?
So, a few reasons why users might opt to expose their services through AeroGear controller:
- Consistent way of exposing enterprise services externally for mobil developers
Using Camel to integrate with existing services is a great option as Camel has a huge number of components. There is a SwitchYard Camel component too, so integrating with SwitchYard would also be possible using Camel. SwitchYard also has a new RemoteInvoker which could be used for SwitchYard specific services and would be a separate controller class.
The goal here is to make things as flexibile as possible as it is difficult to try to account for different types of services. As a suggestion, an AeroGear Controller route that invokes a service using Camel might look like this:
CarServiceController.class might look something like this:
CamelController is very simple and gets injected with a CdiCamelContext and creates the ProducerTemplate.
We are simply making an instance of ProducerTemplate available to users, and they have access to all the methods of that interface. This will enable users to send one way messages, request/response messages, and also prepare the arguments to the service and process the result if needed.
A ProducerTemplate is created from a CamelContext. One can have multiple CamelContext's per application/deployment but the most common is that each deployment has one CamelContext. In this case we are injecting CdiCamelContext.
We could also add additional methods from ProducerTemplate to CamelController which just delegate, for example:
This would save subclasses from having to call
As mentioned above, SwitchYard has a RemoveInvoker that could be used for invoking services from a remote client. This could be used in an AeroGear route:
SwitchYard is again very simple:
aerogear-dev mailing list