Friday, April 13, 2012

Apache Camel at CamelOne

FuseSource organises for the second time an event dedicated to the famous Apache Camel EIP Framework - CamelOne, the 15th  and 16nd of May. This conference is not only a vitrine dedicated to Apache Camel Integration framework or FuseSource products but related technologies like ESB, SOA, BPM, Cloud, MOM, HTML5, Big Data and Real Time applications will be presented through a panel of different CamelOne talks and speakers (Rob Davies, James Strachan, Claus Ibsen, Hiram Chirino, Tony Shan, Robin Howlett, Dan Kulp, Jon Anstey, Kai Wahner, Charles Moulliard, Jazon Van Zyl, ...).

A special attention was also given this year to present projects deployed and running in Enterprise (Christian Mueller - Atos, Rob Terpilowski - Lynden, Matt Pavlovich - Media Driver, David Reiser, Ram Raju and Shane Kent -- Department of Transportation, Robin Howlett - Silver Chalice) proving that Apache Camel is not only used by early adopters but is now part of the Enterprise Software Architecture like RDBMS and Web Technologies. 

If your are not yet registered, I recommend to do it to have the chance to meet some Apache Committers and people working every day with SOA and Integration projects. This is incredible opportunity which is only offered one time a year. Do not forget that the CamelOne conference include also a program to train people on Apache Camel, ActiveMQ and Apache ServiceMix.



Friday, December 16, 2011

Run a Google Web Toolkit 2 project on Apache Karaf/ServiceMix

To simplify the development of Web projects on Apache Karaf/Apache ServiceMix, we have created archetypes to setup WAR or WAB projects. They are very basic but they can be enriched with framework like Struts 2, Wicket, plain JSP or MyFaces JSF as they are currently supported on Apache Karaf - ServiceMix.

For the GWT users, it exists now an archetype which will create a GWT 2.4 project. To create such a project, you must generate a project from the archetype

mvn archetype:generate \
   -DarchetypeGroupId=org.ops4j.pax.web.archetypes\
   -DarchetypeArtifactId=wab-gwt-archetype \
   -DarchetypeVersion=2.1.2 \
   -DgroupId=com.mycompany \
   -DartifactId=hello \
   -Dversion=1.0



build next the WAB using hello/mvn clean install

and deploy it on Apache Karaf



Verify that the web site is well registered :



Next, you can navigate to your application in your browser and click on the button to say Hello.




Remark : A WAB project is nothing more than a WAR excepted it is packaged as a bundle file, that we have removed the WEB-INF/lib dependencies and create a MANIFEST file containing the OSGI instructions.


Monday, November 21, 2011

Apache Camel, Cxf, ActiveMQ & ServiceMix at Devoxx

This year, I get the chance to present 2 talks at the Devoxx event,



one for University Talk and the other for Hands on Lab. With the help of Gert Vanthienen, we took the time to present in more detail what finally we can design as solution, architecture with Apache projects like Camel, CXF, ActiveMQ and ServiceMix and move it into a scalable, high-available platform.

That was a great challenge as this is not really easy to introduce "integration" which is not so sexy comparing to a Web Development framework, an iPhone or Android application. But times are changing and a lot of developers / architects are interested by agile approaches that we develop at Apache foundation.

With Fuse IDE tool,we can now accelerate the creation of a project using Apache Camel. The wysiwig editor and EIPs patterns allow you to quickly create new routes while the runtime editor enable to review existing project. IDE is more than a tool as it allows to run and deploy the routes in Fuse ESB, Tomcat application servers or locally. The tool is not yet finalized (release 2.1 should be available soon) but it offers a lot of possibilities to facilitate integration projects, tracing of messages (= exchanges) and investigation about time passing through the different processors.


Integration projects are moving into cloud space and this is what we have presented next with FuseSource Fabric. Fabric is not a new hype but a strategy to reduce impact of OSGI dependencies calculation, provisioning of Apache Camel routes on local, remote or cloud instances using Apache Zookeeper as registry of artefacts to be deployed (features, jars, configurations). It offers also elastic services when deploying services into the cloud.



For those who were not there, here are the links of the presentation like also the hands on lab material that we have used in the afternoon to develop a real Japa Application Project (Spring, JPA, Web) on Fuse ESB.
Remark : The step by guide is available on the github repo like also the skeleton (zip file)

Thursday, February 24, 2011

Talks about Integration with Camel and ESB

This year, I plan to make some talks about Apache ServiceMix, Apache Camel, apache ActiveMQ and show how easy it is to build integration solutions with Apache technologies.

Take free time, a two break hours and joint me during one of the following events :

Agenda

The purpose of this presentation/demo is to show you how easy it is to design integration between systems (web services, file systems, database, queue engine) using the projects Camel, ServiceMix and ActiveMQ of the foundation Apache.

First part :

Presentation of the projects Camel, ServiceMix and ActiveMq
Description of the topologies proposed : messaging, osgi, web, ...
High-availability and scalability (ServiceMix and/or ActiveMQ)

Second part :

Making of of the demo solution
Transpose it into camel DSL language
Coding of WebService (using Apache CXF), DAO and Persistence layer (Spring + Hibernate JPA) and Web layer (Apache Wicket),
Development of Camel routes,
Packaging and Deployment
Demo

Wednesday, February 23, 2011

Measure elapsed time with Camel

With the last version of Apache Camel, we provide a event notifier support class which allow to keep information about what happen on Exchange, Route and Endpoint. One of the benefit of this class is that you can easily audit messages created in Camel Routes, collect information and report that in log by example.

When developing an application, it is very important to calculate/measure elapsed time on the platform to find which part of your code, processor or system integrated which is the bad duck and must be improved.

In three steps, I would show you How to enable this mechanism to report :
- Time elapsed to call an endpoint (could be another camel route, web service, ...)
- Time elapsed on the route exchange

STEP 1 - Create a Class implementing the EventNotifierSupport



public class AuditEventNotifier extends EventNotifierSupport {

public void notify(EventObject event) throws Exception {
if (event instanceof ExchangeSentEvent) {
ExchangeSentEvent sent = (ExchangeSentEvent) event;
log.info(">>> Took " + sent.getTimeTaken() + " millis to send to external system : " + sent.getEndpoint());
}

if (event instanceof ExchangeCompletedEvent) {;
ExchangeCompletedEvent exchangeCompletedEvent = (ExchangeCompletedEvent) event;
Exchange exchange = exchangeCompletedEvent.getExchange();
String routeId = exchange.getFromRouteId();
Date created = ((ExchangeCompletedEvent) event).getExchange().getProperty(Exchange.CREATED_TIMESTAMP, Date.class);
// calculate elapsed time
Date now = new Date();
long elapsed = now.getTime() - created.getTime();
log.info(">>> Took " + elapsed + " millis for the exchange on the route : " + routeId);
}
}

public boolean isEnabled(EventObject event) {
return true;
}

protected void doStart() throws Exception {
// filter out unwanted events
setIgnoreCamelContextEvents(true);
setIgnoreServiceEvents(true);
setIgnoreRouteEvents(true);
setIgnoreExchangeCreatedEvent(true);
setIgnoreExchangeCompletedEvent(false);
setIgnoreExchangeFailedEvents(true);
setIgnoreExchangeRedeliveryEvents(true);
setIgnoreExchangeSentEvents(false);
}

protected void doStop() throws Exception {
// noop
}

}


Not really complicated and the code is explicit. Check the doStart() method to enable/disable the events for which you would like to gather information.

This example uses only Exchange.CREATED_TIMESTAMP property but the next version of Camel 2.7.0 will provide you the property exchange.RECEIVED_TIMESTAMP and so you will be able to calculate more easily the time spend by the exchange to call the different processors till it arrives at the end of the route.

This example collects Date information but you can imagine to use this mechanism to check if your route processes the message according to SLA, ....

STEP 2 - Instantiate the bean in Camel Spring XML


<!-- Event Notifier -->
<bean id="auditEventNotifier" class="com.sfr.audit.AuditEventNotifier">
</bean>

By adding this bean definition, Camel will automatically register it to the CamelContext created.

STEP 3 - Collect info into the log

18:10:46,060 | INFO | tp1238469515-285 | AuditEventNotifier | ? ? | 68 - org.apache.camel.camel-core - 2.6.0.fuse-00-00 | >>> Took 3 millis for the exchange on the route : mock-HTTP-Server
18:10:46,062 | INFO | tp2056154542-293 | AuditEventNotifier | ? ? | 68 - org.apache.camel.camel-core - 2.6.0.fuse-00-00 | >>> Took 25 millis to send to external system : Endpoint[http://localhost:9191/sis]
18:10:46,077 | INFO | tp2056154542-293 | AuditEventNotifier | ? ? | 68 - org.apache.camel.camel-core - 2.6.0.fuse-00-00 | >>> Took 103 millis for the exchange on the route : ws-to-sis

Friday, September 24, 2010

Secure Web Services - WS-Security

Security is one of the important key in the success of a IT project but most of the time only user authentication or data encryption are taken into account. So security of the application is often not adressed or leave aside due to complexity of the implementation.
One of the reason explaining this situation comes from the fact that solutions or frameworks proposed to secure an application are difficult to configure and maintain. And this remark prevalls over the specification WS-Security.

In large company having deployed WS-Services to allow intra or inter connection between applications, Web application authentication with HTTPS protocol mechanisms are use to secure platforms. That means that users discovering the credentials used to connect to the web server can potentially have access to the services of the company.

WS-Security offers a way to authenticate the user connected to a web service or allow also a user to be trusted on the web server it is connected. This mechanism is interesting because it reinforce the security but provides also a way to restrict access to unauthorized users to web services.

Apache Camel and CXF frameworks offers a simplify way to implement this with only few lines of code and spring beans definition. Let's see that in action :

STEP 1

We only need to use JAAS api to authenticate the user using the following java package "javax.security.auth.callback" and the project WS4J of Apache. Here is a simple example authenticate a user using a list and the password provided.


package org.apache.camel.example.reportincident;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.UnsupportedCallbackException;

import org.apache.ws.security.WSPasswordCallback;

/**
* Callback handler to handle passwords
*/
public class UTPasswordCallback implements CallbackHandler {

private Map passwords = new HashMap();

public UTPasswordCallback() {
passwords.put("claus", "sualc");
passwords.put("charles", "selrahc");
passwords.put("james", "semaj");
passwords.put("abcd", "dcba");
}

/**
* Here, we attempt to get the password from the private alias/passwords map.
*/
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {

String user = "";

for (int i = 0; i < pc =" (WSPasswordCallback)" user =" pc.getIdentifier();" pass =" passwords.get(user);" string="">


STEP 2 This is here that the magic will operates as we will use Spring beans definition with Apache Web Services Framework - CXF and Apache Camel to expose the web service

Instantiate your WS4J bean














Add it as an interceptor to CXF to allow CXF to authenticate the user using the credentials provided in the SOAP header definition.



















Here is an example of the SOAP header






2010-09-24T07:31:06.308Z
2010-09-24T07:36:06.308Z


charles
KoNvkEh9jwgvxTfcTza6+kHkKNI=
havIKNKvlRuatlp3CncMKw==
2010-09-24T07:31:06.306Z





222
2010-07-14
Charles
Moulliard
Bla
Bla bla

cmoulliard@apache.org
0011 22 33 44





And finally, declare your camel route using the web services


















To play with the example, follow this example of Camel CXF and enjoy it !

Thursday, September 23, 2010

Fuse Community Day - Paris - 14th of October

The Fuse Community Day will take place the 14th of October in Paris. Feel free to sign up here and come to see Claus Ibsen, Guillaume Nodet, Rob Davies and myself presenting news about OSGI, SOA, Camel and ESB and some of our customers showing that in action (Lionel Cons - CERN, Cédric Bourgeois - Atos Worldwide, Jean Folly-Kpodar - Osmocom).