...
Note | ||
---|---|---|
| ||
This tutorial is a work in progress and the last parts is not yet complete. Please check back for updates |
Tip | ||
---|---|---|
| ||
NOTE: Before beginning this tutorial, please take the time to read the FAQ entry titled Should I Create My Own JBI Components?. It is very important that you understand the reason for developing a JBI service engine and this FAQ entry will explain this. |
This tutorial describes how to create a very simple Hello World style of JBI service engine. This tutorial is as minimalistic as possible so as to focus on key concepts and not drown in details. The Hello World component will respond to all requests with the message:
Panel |
---|
<hello>Hello World! Message \ [<original message here>\] contains \ [??\] bytes.</hello> |
The following sections will walk through the creation, packaging, testing and deployment of the Hello World service engine.
...
No Format |
---|
[INFO] Scanning for projects... [INFO] ---------------------------------------------------------------------------- [INFO] Building A custom project [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.se/1.0 for namespace: http://org.apache.servicemix.samples.helloworld.se/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.se/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.se/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.se/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.se/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.se/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 ------------------------------------------------------- T E S T S ------------------------------------------------------- Running org.apache.servicemix.samples.helloworld.se.MySpringComponentTest <hello>Hello World! Message [<hello>Ski Colorado!</hello>] contains [28] bytes</hello>. Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.487 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [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/se/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/se/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/se/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/se/hello-world-se/1.0-SNAPSHOT/hello-world-se-1.0-SNAPSHOT-installer.zip [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 16 seconds [INFO] Finished at: Mon Jan 15 13:19:51 MST 2007 [INFO] Final Memory: 13M/24M [INFO] ------------------------------------------------------------------------ |
Notice that not only do we see that the build was successful, but also note the text in the output above that was printed by the test (*<hello>Hello World! Message \ [<hello>Ski Colorado!</hello>\] contains \ [28\] bytes.</hello>*). This is the message we were expecting to be output from the test. So if you see this, you just wrote a JBI component and tested it successfully. Now this SU needs to be wrapped in a SA so it can be deployed to the JBI container. Wiki Markup
Deploying the Component
Now it's time to deploy this component to the JBI container. Because the component was just built above, you should now see a filed named hello-world-se-1.0-SNAPSHOT-installer.zip
in the target directory of the project. This is the component all packaged up and ready to be deployed. To deploy the component, simply copy the ZIP file to the ServiceMix install
directory. You can do this before starting ServiceMix or while ServiceMix is running.
...