Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: cross references, plugin version requirement

Tutorial: Creation of a "Hello World - SE"

Note: The content of this document is overlapping with Creating a Standard JBI Component and Notes on Creating JBI Component using maven2. Any changes you might want to do for this document might be relevant for them as well. Questions unanswered by this document may be answered by the other documents.

This tutorial describes how to create a very simple "Hello world" JBI service engine (SE) component, pack it into a Service Unit (SU) which will be packed to a Service Assambly (SA), and finally how to run the SE inside ServiceMix. The SE will answer received messages with "Hello, I received xyz bytes!", so we literally see that it works. As it has the same structure as real, useful SE, the given hints help to use the presented code as a blueprint to create own SE-SA-SUs. Still, the example is as minimalistic as possible, so readers shall not get lost in too many details but get an idea of the big picture.

...

Note
titleTODO

INS When to use this JBI Component
INS Using the component that you created

provide exact position in the SVN!
/samples/hello-world-SE-SU-SA/
integrate from SVN source like it is done at Configuration at http://www.servicemix.org/site/visualisation.html

maybe moving the content of overlapping existing docus to this new tut and - where appropriate - delete the old ones (only leaving a redirect).
http://www.servicemix.org/site/notes-on-creating-jbi-component-using-maven2.html
http://www.servicemix.org/site/creating-a-standard-jbi-component.html
are already fully incorporated, so delete content and point from there to here (and delete note at the very top)

This shall already include everything stated at
http://www.servicemix.org/site/maven-jbi-plugin.html#MavenJBIplugin-GettingStarted
and
http://www.servicemix.org/site/working-with-components.html

provide additional reading
Creating a protocol bridge.for a "bigger" example
The examples page lists examples providing more information, showing further possibilities and components.

...

Maven creates a new folder having the same name as the artifact ID provided (printed in green in the command and output). Inside this folder, a file called pom.xml is created. This contains the Project Object Model providing Maven with all needed information for building (see Introduction to the POM at the Maven website). Moreover, Java source files and tests were created.

Note
titleIn case of a BUILD ERROR: Maven plugin version requirement

The  maven-archetype-plugin 1.0-alpha4 or above is required for this tutorial. When an older version is installed, a BUILD ERROR will occur. The version can be checked by having a look at the name of the directories contained in ~/.m2/repository/org/apache/maven/plugins/maven-archetype-plugin (~ is you user directory, on Windows C:\Documents and Settings\<USERNAME>). In case only an older version is presend, we create a minimal pom.xml in the folder where we're calling the mvn archetype:create goal in (so the current folder) and fill the created file with the following content: 

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>mygroup</groupId>
    <artifactId>myartifact</artifactId>
    <version>myversion</version>
    <packaging>pom</packaging>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-archetype-plugin</artifactId>
                    <version>1.0-alpha-4</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

Creating the stub of the SU and SA 

...