Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This tutorial describes how to create a very simple Hello World style of JBI service engine (SE) component. It demonstrates some best practices for creating JBI components. The example in this tutorial is as minimalistic as possible so as to focus on key concepts and not drown in details. The example component will respond to all requests with the message:

Panel

Wiki Markup
<hello>Hello World! Message \[<original message here>\] contains \[??\] bytes.</hello>
Hello, I received <xyz> bytes!

Prerequisites

  • Maven 2.0.4 or higher
    • If you have never used Maven previously the Maven Getting Started Guide explains some valuable concepts surrounding Maven
  • ServiceMix 3.1 or higher
  • A broadband internet connection (so Maven can automatically download dependencies)

...

Panel

Wiki Markup
\[INFO\] Scanning for projects...
\[INFO\] ----------------------------------------------------------------------------
\[INFO\] Building Hello World Service Engine
\[INFO\]    task-segment: \[install\]
\[INFO\] ----------------------------------------------------------------------------
\[INFO\] \[xbean:mapping \{execution: default\}\]
Checking: org.apache.servicemix.samples.helloworld.se.MyComponent
Checking: org.apache.servicemix.samples.helloworld.se.MyEndpoint
\[INFO\] Generating META-INF properties file: /Users/bsnyder/src/hello-world-smx/hello-world-se/target/xbean/META-INF/services/org/apache/xbean/spring/http/org.apache.servicemix.samples.helloworld/1.0 for namespace: http://org.apache.servicemix.samples.helloworld/1.0
\[INFO\] Generating Spring 2.0 handler mapping: /Users/bsnyder/src/hello-world-smx/hello-world-se/target/xbean/META-INF/spring.handlers for namespace: http://org.apache.servicemix.samples.helloworld/1.0
\[INFO\] Generating Spring 2.0 schema mapping: /Users/bsnyder/src/hello-world-smx/hello-world-se/target/xbean/META-INF/spring.schemas for namespace: http://org.apache.servicemix.samples.helloworld/1.0
\[INFO\] Generating HTML documentation file: /Users/bsnyder/src/hello-world-smx/hello-world-se/target/xbean/hello-world-se.xsd.html for namespace: http://org.apache.servicemix.samples.helloworld/1.0
\[INFO\] Generating XSD file: /Users/bsnyder/src/hello-world-smx/hello-world-se/target/xbean/hello-world-se.xsd for namespace: http://org.apache.servicemix.samples.helloworld/1.0
\[INFO\] Generating WIKI documentation file: /Users/bsnyder/src/hello-world-smx/hello-world-se/target/xbean/hello-world-se.xsd.wiki for namespace: http://org.apache.servicemix.samples.helloworld/1.0
Warning, could not load class: org.apache.servicemix.samples.helloworld.se.MyEndpoint
\[INFO\] ...done.
Downloading: http://repo.mergere.com/maven2/xml-security/xmlsec/1.3.0/xmlsec-1.3.0.pom
\[WARNING\] Unable to get resource from repository central (http://repo1.maven.org/maven2)
Downloading: http://repo.mergere.com/maven2/wss4j/wss4j/1.5.0/wss4j-1.5.0.pom
\[WARNING\] Unable to get resource from repository central (http://repo1.maven.org/maven2)
\[INFO\] \[jbi:generate-jbi-component-descriptor\]
\[INFO\] Generating jbi.xml
\[INFO\] \[resources:resources\]
\[INFO\] Using default encoding to copy filtered resources.
\[INFO\] \[compiler:compile\]
\[INFO\] Nothing to compile - all classes are up to date
\[INFO\] \[resources:testResources\]
\[INFO\] Using default encoding to copy filtered resources.
\[INFO\] \[compiler:testCompile\]
\[INFO\] Nothing to compile - all classes are up to date
\[INFO\] \[surefire:test\]
\[INFO\] Surefire report directory: /Users/bsnyder/src/hello-world-smx/hello-world-se/target/surefire-reports

Wiki Markup
-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running org.apache.servicemix.samples.helloworld.se.MySpringComponentTest
*<hello>Hello World! Message \[<hello>Ski Colorado!</hello>\] contains \[28\] bytes<bytes.</hello>.*
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.009 sec

Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

Wiki Markup
\[INFO\] \[jar:jar\]
\[INFO\] Building jar: /Users/bsnyder/src/hello-world-smx/hello-world-se/target/hello-world-se-1.0-SNAPSHOT.jar
\[INFO\] \[jbi:jbi-component\]
\[INFO\] Generating installer /Users/bsnyder/src/hello-world-smx/hello-world-se/target/hello-world-se-1.0-SNAPSHOT-installer.zip
\[INFO\] Building jar: /Users/bsnyder/src/hello-world-smx/hello-world-se/target/hello-world-se-1.0-SNAPSHOT-installer.zip
\[INFO\] \[install:install\]
\[INFO\] Installing /Users/bsnyder/src/hello-world-smx/hello-world-se/target/hello-world-se-1.0-SNAPSHOT.jar to /Users/bsnyder/.m2/repository/org/apache/servicemix/samples/helloworld/hello-world-se/1.0-SNAPSHOT/hello-world-se-1.0-SNAPSHOT.jar
\[INFO\] Installing /Users/bsnyder/src/hello-world-smx/hello-world-se/target/xbean/hello-world-se.xsd to /Users/bsnyder/.m2/repository/org/apache/servicemix/samples/helloworld/hello-world-se/1.0-SNAPSHOT/hello-world-se-1.0-SNAPSHOT.xsd
\[INFO\] Installing /Users/bsnyder/src/hello-world-smx/hello-world-se/target/xbean/hello-world-se.xsd.html to /Users/bsnyder/.m2/repository/org/apache/servicemix/samples/helloworld/hello-world-se/1.0-SNAPSHOT/hello-world-se-1.0-SNAPSHOT-schema.html
\[INFO\] Installing /Users/bsnyder/src/hello-world-smx/hello-world-se/target/hello-world-se-1.0-SNAPSHOT-installer.zip to /Users/bsnyder/.m2/repository/org/apache/servicemix/samples/helloworld/hello-world-se/1.0-SNAPSHOT/hello-world-se-1.0-SNAPSHOT-installer.zip
\[INFO\] ------------------------------------------------------------------------
\[INFO\] BUILD SUCCESSFUL
\[INFO\] ------------------------------------------------------------------------
\[INFO\] Total time: 15 seconds
\[INFO\] Finished at: Thu Jan 04 15:21:00 MST 2007
\[INFO\] Final Memory: 13M/24M
\[INFO\] ------------------------------------------------------------------------

...