Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Creating a Hello World JBI Binding Component

Warning
titleATTENTION!
Note
titleRework ToDo-List
  • when to create a binding component?
  • outline the different jbi packaging units (bc, se, su, sa, sl)
  • construct a real use case for the bc (for example a snmp poll service for grabbing snmp values of a network device like printer)
  • start by setting up the folder structure and the root pom -> watch out for not working maven:create and the incomplete BC archetype
  • define as much as possible inside the root pom (maybe done when the SU is created)
  • create the binding component
  • describe the pom content
  • detailed description of the key concepts
  • describe the base classes of the new bc and their role
  • a note on the annotations which control the elements in the su's xbean.xml
  • a note on different MEPs to support (or not)
  • doing a consumer endpoint (poller)
  • doing a test case for the bc
  • testing the bc
  • creating a service unit for the bc
  • describe how to configure the pom.xml
  • describe how to setup the xbean.xml
  • create the service assembly
  • configure the sa to package the su
  • deployment of the sa -> bc is still missing -> describe dependency resolving mechanism
  • deployment of the bc -> see the SA now deploying
  • see result of the polling in console window
  • for experienced users:
  • doing a provider endpoint (left over for the experienced reader to implement)
  • describe marshaler logic as it is used in nearly every SE / BC of smx
  • implement a marshaler (for more experienced readers, this will also affect the BC to provide such possibility)
  • add a file-sender to write snmp poll results to a file and wire it to the snmp poller
  • deployment and testing
  • give links etc. for further reading and for looking at other BC's code (snippets)


    *This tutorial page is a work in progress and it may contain outdated information or may not work at all. It will be reworked soon, so check back later for updates.

    This is the ToDo list for reworking the wiki page. Feel free to add points of interest.

    may not work at all.
    There are currently no plans to resume work on this tutorial.






    Tip
    titleShould I Create My Own JBI Components?

    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 binding component and this FAQ entry will explain this.

    This tutorial describes how to create a very simple Hello World style of JBI binding component. This tutorial is as minimalistic as possible so as to focus on key concepts and not drown in details. The Hello World binding component will respond to all requests with the message:

    unmigrated-wiki-markup
    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 binding component.

    ...

    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: unmigrated-wiki-markup

    *<?xml version="1.0" encoding="UTF-8"?><hello>Message \ [Ski Colorado!\] contains \ [13\] 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 your first JBI BC successfully.

    ...

    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 for further work:

    • Get Messages
    • read Messagesunmigrated-wiki-markup
    • count the bytes
      Maybe easiest by XSLT endpoint (can be used to apply an XSLT stylesheet to the incoming exchange and will return the transformed result as the output message.)
      see \ [ servicemix-saxon\|servicemix-saxon\]
    • send a message back
    • Configure SA so that the example receives messages
      create & populate
      C:\hello-world-SE-SU-SA\hello-world-SU\src\main\resources\servicemix.xml
    • as MyDeployer extends AbstractXBeanDeployer create xbean.xml for SU
    • make something send messages (eg quartz timer, HTTP POST,...) and dump the answer (eg TraceComponent, FireWriter, EIP,...)
    • add a chapter what user may do now / "how to continue when having the working example"

    Classpath for SU to include manually till v3.1, see mail

    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

    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 version14
    http://www.servicemix.org/site/creating-a-standard-jbi-component.html version26
    are already fully incorporated in the mentioned versions, 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.

    ...