Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Creating

...

a

...

new

...

Spring

...

based

...

Camel

...

Route

...

If

...

you

...

want

...

to

...

create

...

your

...

own

...

version

...

of

...

the

...

Spring

...

Example

...

you

...

can

...

use

...

the

...

maven

...

archetype.

{
Code Block
}
mvn archetype:creategenerate                   \
  -DarchetypeGroupId=org.apache.camel.archetypes  \
  -DarchetypeArtifactId=camel-routerarchetype-spring   \
  -DarchetypeVersion=1.15.0             \
  -DgroupId=myGroupId                  \
  -DartifactId=myArtifactId   
{code}

*Note*: The newer version 2.0-alpha-1 of the maven-archetype-plugin breaks the above command.  As a workaround until this gets resolved you can specify the version explicitly as below.
{
mvn org.apache.maven.plugins:maven-archetype-plugin:1.0-alpha-7:create  \
  -DarchetypeGroupId=org.apache.camel                                  \
  -DarchetypeArtifactId=camel-router                                   \
  -DarchetypeVersion=1.1.0                                             \
  -DgroupId=myGroupId                                                  \
  -DartifactId=myArtifactId   
}

This will create a maven project which can be

Note: -DarchetypeVersion=1.5.0 is the version number of Camel. Change this to the current version of Camel you are using.

Info

When using camel archetypes, make sure your package name is not org.apache.camel (or a sub package of this) as this will instruct Camel to search in its own packages for your routes. This can also cause Camel not to start, as shown in CAMEL-1197. You can change your package name by specifying -Dpackage

This will create a maven project which can be run immediately via the Camel Maven Plugin as follows

Code Block
 run immediately via the [Camel Maven Plugin] as follows

{code}
cd myArtifactId
mvn camel:run
{code}

The

...

configuration

...

file

...

is

...

in

...

src/main/resources/META-INF/spring/camel-context.xml

...

.

...

The

...

routing

...

rules

...

lives

...

at

...

src/main/java/myGroupId/MyRouteBuilder.java

...