Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: restructured

...

This tutorial shows the desired/best practices or "clean" way to create a SE-SA-SU using ServiceMix Maven archetypes and the Maven plugin (see Maven JBI plugin), so how the workflow shall be - of course, other possibilities exist and may be better suited for certain situations. Furthermore, it will explain the reasons for critical choices and how required information can be retrieved. Where appropriate, additional reading will be is suggested.

To make it as easy as possible to follow the descriptions, they contain only the relevant code snippets, while the full code is available in the SVN repository. Please note that the code snippets are fetched directly from the full code in the SVN repository, thus the wiki and the code share always at the same, up to date state.

Tip
titleHandy Hints

This tutorial is especially useful for ServiceMix beginners.

The Maven Getting Started Guide is a recommended and short reading. It explains most of the Maven related things needed.

Warningnote
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
is are already fully incorporated, so delete content and point from there to here

ServiceMix can be used as a protocol bridge. The following tutorial will explain how to create a JBI Service Assembly (aka a JBI application) to bridge two different protocols. In this example, we will bridge the HTTP/SOAP with the JMS protocol using an InOnly MEP. We will also put between the two protocols an XSLT transformation.
We will leverage ServiceMix archetypes and maven plugin (see Maven JBI plugin).

provide additional reading
Creating a protocol bridge.for a "bigger" example

Maybe add testing

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

Prerequisites

The following is required:

...

Panel

Wiki Markup
\[INFO\] Scanning for projects...
\[INFO\] Searching repository for plugin with prefix: 'archetype'.
\[INFO\] \---------------------------------------------------------------------------\-
\[INFO\] Building Maven Default Project
\[INFO\]    task-segment: \[archetype:create\] (aggregator-style)
\[INFO\] \---------------------------------------------------------------------------\-
...
\[INFO\] <span style="color: #ff00ff">Defaulting package to group ID: org.apache.servicemix.samples.helloWorldSE</span>
...
\[INFO\] \**\**\**\**\**\**\**\**\**\**\* End of debug info from resources from generated POM \**\**\******************\*
\[INFO\] <span style="color: #009900">Archetype created in dir: C:\hello-world-SE-SU-SA\hello-world-SE</span>
\[INFO\] \-----------------------------------------------------------------------\-
\[INFO\] BUILD SUCCESSFUL
\[INFO\] \-----------------------------------------------------------------------\-

...

No Format
[INFO] Scanning for projects...
[INFO] ----------------------------------------------------------------------------
[INFO] Building A custom project
[INFO]    task-segment: [test]
[INFO] ----------------------------------------------------------------------------
...
[INFO] [compiler:compile]
...
[INFO] [surefire:test]
[INFO] Setting reports dir: c:\java\tmp\servicemix-helloWorldSE\target/surefire-reports
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
[surefire] Running org.apache.servicemix.samples.helloWorldSE.MySpringComponentTest
...
[surefire] Tests run: 1, Failures: 0, Errors: 0, Time elapsed: 1,422 sec
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
...
Note
titleTODO

Maybe add further testingat the end of the tutarial (as "how to continue when having the working example")

Generation and deployment of the SA

...

Note
titleDeploying Dependencies

When working with the jbi:projectDeploy one may want to disable dependency deployment. When deploying to a server which has other components sharing these dependencies, they can cause problems while trying to undeploy and redeploy them. To stop the jbi-maven-plugin undeploying and redeploying dependencies, the configuration files (usually in the SA's or the component's pom.xml) have to be extended by a new element entity called deployDependencies with a value of false (<deployDependencies>false</deployDependencies>). This has to be placed in the configuration section for the jbi-maven-plugin. The final structure looks like this :(reduced to the bare minimum, the inserted entity is bold):

<build>
    <plugins>
        <plugin>
            <artifactId>jbi-maven-plugin</artifactId>
            <configuration>
                <deployDependencies>false<                 <deployDependencies>false</deployDependencies>
            </configuration>
        </plugin>
    </plugins>
</build>

Adding functionality

Configuring the Service Assembly

manually editing http://goopen.org/confluence/display/SM/Working+with+Service+Units

manually editing http://www.servicemix.org/site/working-with-service-assemblies.html

use the SU archetype like in http://www.servicemix.org/site/creating-a-protocol-bridge.html

use the SA archetype like in http://www.servicemix.org/site/creating-a-protocol-bridge.html

The structure is done, so the functionality have to be added. Using an IDE like IDEA or
Eclipse this is easier; here, the workflow with Eclipse is described. 

Note
titleTODO

The default implementation of the component accepts InOut MEPs (ADD
LINK TO FURTHER READING CONCERNING MEPs) and return the input content
as the out message. This is already nearly what we want.
 OUTLINE:
Get Messages
read Messagescount the bytessend a message backConfigure SA so that the example receives messages
make something send messages (eg quartz timer, HTTP POST,...) and dump the answer (eg TraceComponent, FireWriter, EIP,...)
 manually editing http://goopen.org/confluence/display/SM/Working+with+Service+UnitsImage Added

manually editing http://www.servicemix.org/site/working-with-service-assemblies.htmlImage Added

use the SU archetype like in

Note
titleTODO

it and we now need to fill the holes.

Then you can send an request to ...

The default implementation of the component accepts InOut MEPs and return the input content as the out message.

Using an IDE to add meat to the component. You can either use IDEA or Eclipse, I tried it with Eclipse so I guess I am going to stick it for now. <TODO>

This shall already include everything stated at
http://www.servicemix.org/site/mavencreating-a-jbiprotocol-plugin.html#MavenJBIplugin-GettingStarted
and
bridge.htmlImage Added

use the SA archetype like in http://www.servicemix.org/site/workingcreating-a-withprotocol-componentsbridge.htmlImage AddedÂ