background preloader

Camel

Facebook Twitter

Apache Camel: Integration Nirvana. Take any integration project and you have multiple applications talking over multiple transports on multiple platforms.

Apache Camel: Integration Nirvana

As you can imagine, in large enterprise applications this can get complex very fast. Much of the complexity stems from two issues: 1. dealing with the specifics of applications and transports, and2. coming up with good solutions to integration problems. Making your applications speak transports and APIs is relatively easy on its own. I'm sure everyone knows how to send JMS messages to their broker of choice; though it still requires in depth knowledge of the JMS specification, which many developers may not have. Ignoring the mechanics of how to connect with multiple transports and APIs, we can focus on the high level design of how applications interact. Apache Camel was created with the intention of addressing these two issues. What is Camel? Apache Camel is an open source Java framework that focuses on making integration easier and more accessible to developers. 02. 09. Une première approche du Camel d’Apache. English version available Raphaël Delaporte (@rafdelaporte) nous a proposé de dompter un chameau cette semaine au JUG Nantes.

Une première approche du Camel d’Apache

Et ne vous fiez pas à cette photo ! Notre chameau d’informaticien n’est pas un paresseux, bien au contraire ! Retour sur une présentation forte intéressante d’Apache Camel. Apache Camel s’appuie et reprend les Entreprise Integration Patterns – EIP (à ne pas confondre avec les Design Patterns qui sont utilisés pour la conception objet). Les patterns EIP Voici les principaux patterns du plus simple au plus complexe (extrait de la présentation). Entreprise Integration Patterns En les combinant, les possibilités sont quasi-infinies. Un livre complet sur le sujet existe « Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions ». Faire des EIP avec Apache Camel Pour mettre en oeuvre les EIP, on trouve trois éléments de base dans Camel : Une route est conceptualisée de la manière suivante : la liaison de deux endpoints par un processor. » Advanced Apache Camel logging and best practices Middleware Warez. Apache Camel supports a mapped diagnostic context which can be used to improve log entries, but also there is a log component which makes it easier to create log entries.

» Advanced Apache Camel logging and best practices Middleware Warez

Together they can be used to create foundations of activity monitoring without need to deploy another tool or database. Logging anti patterns First of all let’s go throught logging anti patterns described years ago by Gojko Adzic. They are really good and shows how to avoid common problems: Single log file for all peopleLack of hierarchy in log categories (that’s mine idea)Incomplete data in entries (covers also one information split to multiple entries)Different separators in single lineInconsistent log entry format (covers also inconsistent log entry format)Multi-line entriesPopulating log after the action Let describe comon mistakes we can do with Camel and how these anti patterns can look in our case. Single log file Lack of hierarchy in log categories Many libraries use a single log category or only few to do logging. Testing. Writing large Files line by line with Apache Camel.

For a transformation with Smooks we had to parse the incoming EDI files line per line, to create a valid EDI source.

Writing large Files line by line with Apache Camel

For this we wrote a simple route like this: This route reads a file, splits it into line chuncks, each line will be parsed and finally the modified line will be added to a file in the destination folder. Really simple and it does what it was build for… But that approach is really slow. For each line we have a single write operation. This is really expensive as this console output shows: Per line writes are really slow We have files with more that 5 million lines – so at a average of 170 to 200 messages per second we would need nearly 7 hours to parse one file! We added two lines. The result is stunning. Line parsing with aggregation This is twenty times faster!

And voilà. Faire communiquer Thrift et Camel. Apache Camel: Index.