Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

How to write my own binding component

...


This tutorial page is a work in progress and therefore NOT finished. So check back later for updates.


...

The difference between binding components (*BC*s) and service engines (*SE*s) is definitely subtle and is not denoted by the JBI APIs. In fact, the only real true difference between the two is in the jbi.xml descriptor in the packaging. What it really boils down to is the fact that *BC*s are used to do integration with a service outside the bus and *SE*s are services that are deployed to and solely contained within the bus. Hopefully the JBI 2.0 spec will provide more distinction.

...

This tutorial will explain to you how to create a binding component for the SNMP protocol. If you don't know what this protocol is about, then see for example the http://en.wikipedia.org/wiki/Simple_Network_Management_Protocol SNMP Wikipedia entry for further details. As a first step we will only create a snmp polling service. Once you understand how to do this, you will be able to go further and create also a sender service but this will be not done inside this tutorial for now.

...

Below are the steps to follow for creating the directory structure and project. All instructions are laid out to take place on a Unix command-line.

1) Create a directory Maven project named servicemix-snmp and switch to that directory:

...

...

2. Setup a Check the project Maven configuration file

Maven created a project folder for you and already setup a project file called pom.xml. As this is not a beginner tutorial I won't explain the file here.
Open up the pom.xml file in your favorite editor and look at the content if everything is like you want it to be.

...

You will recognize, that the project file is setup for your purposes already. You normally don't need to change anything in there for the moment.

3) Create the binding component sub project

Use the servicemix-binding-component Maven archetype to generate a Maven project for the component.

To create a the BC, execute the following command on the command-line:

...

...

The command above will create a directory named hellosnmp-world-bcbinding that houses a Maven project for the JBI service engine binding component being created here. The name of the directory is taken from the artifactId parameter.

...

Now switch into the snmp-binding sub folder and open the pom.xml in your editor of choice. We will cleanup the file before proceeding to program code.

Do the following things:

  • we already defined repositories in project root pom, so you can safely discard the repository entries in the BC's pom.xml
  • fill in a proper name for the binding component in the name tag

...

...

  • when to create a binding component?
  • outline the different jbi packaging units (bc, se, su, sa)
  • 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)

...





An overview of INLINE

Excerptusing Maven-based tooling and archetypes to develop a snmp binding component

Goals of the document

This tutorial provides an easy and convenient way for a new user to learn about:

...

After finishing this tutorial you have a snmp binding component ready to poll devices. Feel free to play around with it and adding improvements.

Contents

...

...

Start this tutorial

...



...