Camel User Guide. Apache ServiceMix Version 4.5.0

Similar documents
Quickstart Guide. Apache ServiceMix Version SNAPSHOT

Red Hat JBoss Fuse 6.2

Chapter 9. Inter-Bundle Communication

Red Hat JBoss Fuse 6.2.1

Red Hat JBoss Fuse 6.3

Modular Java Applications with Spring, dm Server and OSGi

Wednesday, May 22, 13. Java Business Integration

Apache Camel: Integration Nirvana

Red Hat JBoss Fuse 6.1

Red Hat JBoss Fuse 6.2.1

Service Oriented Integration With Apache ServiceMix

Carrying Enterprise on a Little Camel. (using Apache Camel, Apache ActiveMQ as applications to integrate systems and people)

Red Hat JBoss Fuse 6.3

ESB, OSGi, and the Cloud

SOA-14: Continuous Integration in SOA Projects Andreas Gies

SOA-14: Continuous Integration in SOA Projects Andreas Gies

Red Hat JBoss Fuse 6.0

Red Hat JBoss Fuse 6.2

Configuration Problem Unable To Locate Spring Namespacehandler For Xml Schema Namespace Jpa

JBI User's Guide. Apache ServiceMix Version 4.5.0

Red Hat JBoss Fuse 6.1

We are going to create a bundle that will watch for new MAC addresses that have not been seen before, and log the MAC and switch they were seen on.

Fuse ESB Enterprise Routing Expression and Predicate Languages

RED HAT JBOSS FUSE. A lightweight, flexible integration platform

JBI based ESB as backbone for SOI applications. Michael Wisler Zühlke Engineering AG Submission ID: 687

Agenda. Why OSGi. What is OSGi. How OSGi Works. Apache projects related to OSGi Progress Software Corporation. All rights reserved.

Red Hat Fuse 7.0 Deploying into Apache Karaf

Service Oriented Integration With Apache ServiceMix. Bruce Snyder 21 Nov 2008 Malmo, Sweden

Apache Camel Developer's Cookbook

Deploying JBoss Fuse in Healthcare

RED HAT JBOSS FUSE A lightweight, lexible integration platform

Hiram Chirino Platform Architect June 5th Whats's new in Fuse 6.2

OSGi & Spring combined

Red Hat JBoss Fuse 6.3

Leverage Rational Application Developer v8 to develop OSGi application and test with Websphere Application Server v8

Red Hat JBoss Fuse 6.3

BEAWebLogic. Event Server. WebLogic Event Server Reference

Breaking Apart the Monolith with Modularity and Microservices CON3127

Create your own Carbon Component. Sameera Jayasoma Technical Lead and Product Manager of WSO2 Carbon

Java Lounge. Integration Solutions madeeasy ComparisonofJava Integration Frameworks. Mario Goller

Red Hat JBoss Fuse 6.0

Solace JMS Integration with Red Hat JBoss Fuse (6.0)

Learning Karaf Cellar

Artix ESB. Configuring and Deploying Artix Solutions, Java Runtime. Making Software Work Together TM. Version 5.1, Dec 2007

Red Hat Fuse 7.0 Installing on Apache Karaf

Why real integration developers ride Camels

Groovy & Grails in Depth

Red Hat JBoss Fuse Service Works Integration Recipes, Best Practices & Cheat Codes

EAI War Stories. ! Alexander Martin Praxisbeispiele zu EAI-Pattern und Lessons Learned

BusinessObjects XI Integration Kit for SAP

For use with Red Hat JBoss Data Grid 6.5.1

Red Hat JBoss Fuse 6.2

ChainBuilder Connect IDE Guide 02/04/2010

SpringSource Tool Suite 2.7.1

Boss integration and automation. Tal Portal JBoss Enterprise Consultant

The Actual Real World at EclipseCon/ALM

OSGi on the Server. Martin Lippert (it-agile GmbH)

The Grails Plugin System

Designing, developing, and deploying integration solutions with JBoss Fuse

A4M36ISS: Introduction. Jiří Pechanec QA Engineer September 17 th, 2015

Artix ESB. BMC Patrol Integration Guide. Making Software Work Together TM. Version 5.1, December 2007

Red Hat Fuse 7.0 Managing Fuse

Spoilt for Choice Which Integration Framework to choose? Mule ESB. Integration. Kai Wähner

Tutorial ipojo. 2. Preparation

NetBeans IDE Field Guide

Apache Karaf Cave 4.x - Documentation

J2EE Development with Apache Geronimo. Aaron Mulder Chariot Solutions

Introducing Spring Web Services

Patterns and Best Practices for dynamic OSGi Applications

OSGi In Action: Creating Modular Applications In Java By Richard Hall, Karl Pauls READ ONLINE

Skyway Builder 6.3 Reference

Demystifying OSGi bundles Excerpted from

Creating an application with the Virgo Web Server

Sharing and Deploying MATLAB Applications

Integration Patterns for Mission Critical System of. Systems. OpenSplice DDS. Julien ENOCH Engineering Team Lead PrismTech.

Artix ESB. Configuring and Deploying Artix Solutions, Java Runtime. Making Software Work Together TM. Version 5.0, July 2007

Red Hat Fuse 7.1 Getting Started

EMC Documentum Process Engine

Red Hat Fuse 7.0 Getting Started

Using the OSGi Bundle Repository

Red Hat JBoss Fuse 6.1

How to use J2EE default server

Red Hat JBoss Fuse 6.1

Creating an application with dm Server

SCA Java Runtime Overview

OSGi in Action. RICHARD S. HALL KARL PAULS STUART McCULLOCH DAVID SAVAGE CREATING MODULAR APPLICATIONS IN JAVA MANNING. Greenwich (74 w. long.

IBM. IBM WebSphere Application Server Migration Toolkit. WebSphere Application Server. Version 9.0 Release

Red Hat JBoss Fuse 6.1

Workshop for WebLogic introduces new tools in support of Java EE 5.0 standards. The support for Java EE5 includes the following technologies:

This tutorial explains how you can use Gradle as a build automation tool for Java as well as Groovy projects.

Hello Maven. TestNG, Eclipse, IntelliJ IDEA. Óbuda University, Java Enterprise Edition John von Neumann Faculty of Informatics Lab 2.

Oracle Enterprise Pack for Eclipse 11g Hands on Labs

Comparing JavaBeans and OSGi

WFCE - Build and deployment. WFCE - Deployment to Installed Polarion. WFCE - Execution from Workspace. WFCE - Configuration.

Red Hat JBoss Fuse 6.1

Deploying Custom Step Plugins for Pentaho MapReduce

Oliver Wulff / Talend. Flexibles Service Enabling mit Apache CXF

Red Hat Developer Studio 12.0

Bill Parod, NUIT Architect for Software Development Group, Northwestern University May, 12, 2013

BEAWebLogic. Event Server. Creating WebLogic Event Server Applications

Transcription:

Camel User Guide Apache ServiceMix Version 4.5.0 1

1. Introduction Apache Camel is a powerful open source integration framework based on known Enterprise Integration Patterns with powerful Bean Integration. 1.1. Camel in ServiceMix In ServiceMix, Apache Camel is like our swiss army knife for creating integration solutions. It allows using XML or a Java/Scala-based DSL to express your routes, comes with over 70 optional components, has powerful and versatile Java bean integration, error handling,... and tons of other features. Apache Camel is installed by default if you first start the container. We also have out-of-the-box hot-deployment support for both Spring and Blueprint to make it easy to deploy your own Camel routes, as well as optionally installable features for all the available Camel components. 1.2. Goal of this guide The goal of this guide is to look into the details for using Camel inside ServiceMix: deployment options installing additional components 1.3. Examples The Apache ServiceMix distributions also contain a set of Camel examples. You can find these examples in the examples/camel directory. 1.4. More information about Camel More information about Camel itself, can be found on http://camel.apache.org. There's also a great book available about Camel Ibsen, Claus, and Anstey, Jonathan. (December 2010). Camel in Action. Greenwich, CT: Manning. ISBN: 9781935182368. 2

2. Deployment options There are a few different ways to deploy Camel routes on ServiceMix 4.5.0: deploy routes in a plain Blueprint XML file deploy routes in a plain Spring XML file deploy a bundle containing a Blueprint XML file deploy a bundle containing a Spring XML file Camel routes can also be deployed as part of a JBI SA, allowing you use Camel for routing between JBI endpoints - this option will be discussed later when we are talking about using JBI inside ServiceMix 4. Benefits and drawbacks Plain XML or OSGi bundles Choose a plain XML file: if you want to get routes deployed as quickly as possible all you need for developing routes is a simple text editor, no compilation, building,... required at all if you prefer the XML syntax over the Java of Scala DSL Choose an OSGi bundle: if you want to package helper classes together with your route definitions if you prefer developing routes in the Java or Scala DSL you can package the RouteBuilder implementations inside the bundle Blueprint or Spring Choose Blueprint: if you want the best possible integration with the OSGi Framework and Service Registy the Blueprint specification has been developed specifically for the OSGi Framework by the OSGi Alliance Choose Spring: if you already invested in Spring for creating and running Camel routes 2.1. Deploy as a plain Spring XML file ServiceMix 4.5.0 supports the deployment of plain Spring XML files, automatically creating and starting the Spring ApplicationContext from the XML file. In order to leverage this feature to create and start Camel routes, drop a file with this syntax in the $SERVICEMIX_HOME/deploy folder: 3

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:camel="http://camel.apache.org/schema/spring" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring-2.10.3.xsd"> <camelcontext xmlns="http://camel.apache.org/schema/spring"> <!-- add Camel routes, interceptors,... here --> </beans> An example Just create a new XML file in the deploy folder with the code below to start a route to copy files from one directory to another. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:camel="http://camel.apache.org/schema/spring" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring-2.10.3.xsd"> <camelcontext xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="file:input"/> <log message="copying ${file:name} to the output directory"/> <to uri="file:output"/> </route> </beans> 2.2. Deploy as a plain Blueprint XML file ServiceMix 4.5.0 supports the deployment of plain Blueprint XML files, automatically creating and starting the Blueprint container from the XML file. In order to leverage this feature to create and start Camel routes, drop a file with this syntax in the $SERVICEMIX_HOME/deploy folder: 4

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"> <camelcontext xmlns="http://camel.apache.org/schema/blueprint"> <!-- add Camel routes, interceptors,... here --> </blueprint> An example Just create a new XML file in the deploy folder with the code below to start a route to copy files from one directory to another. <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"> <camelcontext xmlns="http://camel.apache.org/schema/blueprint"> <route> <from uri="file:input"/> <log message="copying ${file:name} to the output directory"/> <to uri="file:output"/> </route> </blueprint> 2.3. Deploy as an OSGi bundle with Spring Using an OSGi bundle to deploy your Camel routes allows you to use the Java or Scala DSL for defining your routes. In this case, you're using Spring to start your Camel routes, so you include your Spring XML file (e.g. camel-context.xml) in the META-INF/spring folder inside your bundle. + <bundle classes, incl. your RouteBuilder> \- META-INF - MANIFEST.MF \- spring \- camel-context.xml After the bundle has been activated, the Spring DM extender will find, create and start your Spring ApplicationContexts. Example: Referring to Java or Scala RouteBuilder classes If your RouteBuilder classes have been defined in the org.apache.servicemix.manual.camel package, the file would look like this: 5

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:camel="http://camel.apache.org/schema/spring" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring-${camel-version}.xsd"> <camelcontext xmlns="http://camel.apache.org/schema/spring"> <package>org.apache.servicemix.manual.camel</package> </package> </beans> Example in the distribution Another example for using this deployment option can be found in the camel-osgi example that is shipped with Apache ServiceMix. 2.4. Deploy as an OSGi bundle Using an OSGi bundle to deploy your Camel routes allows you to use the Java or Scala DSL for defining your routes. In this case, we will use a Blueprint XML file to start your Camel routs. To do so, the Blueprint XML files have to be included in the bundle inside the OSGI-INF/blueprint directory. + <bundle classes, incl. your RouteBuilder> - META-INF - MANIFEST.MF \- OSGI-INF \- blueprint \- camel-context.xml As soon as the bundle becomes Active, the Blueprint extender will create the Blueprint container starting your Routes. Example: Referring to Java or Scala RouteBuilder classes If your RouteBuilder classes have been defined in the org.apache.servicemix.manual.camel package, the file would look like this: <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"> <camelcontext xmlns="http://camel.apache.org/schema/blueprint"> <package>org.apache.servicemix.manual.camel</package> </package> </blueprint> 6

Example in the distribution Another example for using this deployment option can be found in the camel-blueprint example that is shipped with Apache ServiceMix. 7

3. Installing components Camel comes with over 80 components, so you can imagine that we don't install all of them by default. This section shows you how to find available components and how to install them at runtime. List available components Camel components are available as installable features. You can look at the full list of available features using the features:list command, using grep to limit things down to features related to camel: karaf@root> features:list grep camel [installed ] [2.10.3 ] camel repo-0 [installed ] [2.10.3 ] camel-core repo-0 [installed ] [2.10.3 ] camel-spring repo-0 [installed ] [2.10.3 ] camel-blueprint repo-0 [uninstalled] [2.10.3 ] camel-test repo-0 [uninstalled] [2.10.3 ] camel-cxf repo-0 [uninstalled] [2.10.3 ] camel-cache repo-0 [uninstalled] [2.10.3 ] camel-castor repo-0... The items marked with installed in the first column have already been installed and are available for use in your Camel routes. Install and uninstalling components You can use features:install to install any component on the list. An example: to install the camel-cache component karaf@root> features:install camel-cache Similarly, you can also uninstall components that you're no longer using with features:uninstall karaf@root> features:uninstall camel-cache {pygementize} 8

4. Troubleshooting In this section, you'll find solutions for some frequently asked questions when using Camel on ServicMix. No component with id 'xyz' could be found This usually means that your route is trying to use a component that hasn't been installed yet. Solution: 1. install the additional component 2. restart the bundle using the osg:restart <bundle id> command - you can find the bundle id for your route in the output of the osgi:list command Refer to Installing additional components for more information about installing additional components. 9