You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

Creating a new Camel Component

If you want to create your own version of the Camel Component you can use the maven archetype.

mvn archetype:generate                   \
  -DarchetypeGroupId=org.apache.camel.archetypes  \
  -DarchetypeArtifactId=camel-archetype-component \
  -DarchetypeVersion=2.2.0  \
  -DgroupId=myGroupId                  \
  -DartifactId=myArtifactId

This will create a maven project which contains a demo component, you need to implements your own component by modifying it.You need to move the META-INF/services/direct file to META-INF/services/PACKAGE_NAME/FOO where FOO is the URI scheme for your component and any related endpoints created on the fly and PACKAGE_NAME is your component's package name which is replaced the '.' with '/'.

Optional properties (available as of Camel 2.9.0)

By default the camel component archetype will generate a HelloWorldComponent that will use the URI scheme helloworld. You can further customize the generated component by using some custom parameters passed to the component.

Name

Default

Description

name

HelloWorld

The name of the component. It will be used as a prefix for all generated classes.

scheme

helloworld

The default URI scheme the component will use.

Usage Examples:

mvn archetype:generate                   \
  -DarchetypeGroupId=org.apache.camel.archetypes  \
  -DarchetypeArtifactId=camel-archetype-component \
  -DarchetypeVersion=2.2.0  \
  -DgroupId=myGroupId                  \
  -DartifactId=myArtifactId  \
  -Dname=Awesome             \
  -Dscheme=awsome            \
  

For more help see Writing Components

  • No labels