Versions Compared

Key

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

...

  1. The ServiceMix container reads the servicemix.xml file and instantiates the components specified through SpringJBIContainer.
  2. SpringJBIContainer registers the components and the activationSpecs in its afterPropertiesSet method. In this case, httpReceiver and stockQuote are registered as activationSpecs.
  3. SpringJBIContainer uses ActivationSpec class as the container for the component specific properties such as routing information.

Some of its methods are:
setId - takes the spring:id=jbi and sets the id of the container
to "jbi"

setcomponentName = sets componentName to httpReceiver
on one invocation and "stockQuote" when the other
component is instantiated.

setEndpoint - sets the endpoint properties from the
servicemix.xml file

setService - sets the service properties from xml file

setDestinationService = sets the destinationService for
each component

  1. The container determines that FilePoller is an MBean and, therefore, calls the start() method of FilePoller, which it inherits from its parent PollingComponentSupport.
  2. The start() method will: (See: PollingComponentSupport.java code fragment below)
    A. Create a timerTask.
    B. Schedule the timerTask at a fixed rate. The start() method uses the "timer" (created in the init method) to schedule the timerTask at a fixed rate: timer.scheduleAtFixedRate(timerTask, firstTime, period). Recall "period" is a property of FilePoller. It was assigned the value of 1000ms by dependency injection from the servicemix.xml file.
    C. timer will call the run() method of the timerTask periodically. timerTask's run method() is defined inline. This run() method will get the workManager object (see below for details).
    D. The workManager will call "scheduleWork(PollingComponentSupport.this)". Note: it passes in PollingComponent support, which by virtue of its inheritance hierarchy, is of type "Work", which is a "Runnable" object.
    E. "workManager.scheduleWork(Work)" will get a Thread, passing in a Runnable object, i.e. PollingComponentSupport, and call its run() method.
    F. PollingComponent's run() method calls poll(), which is implemented in FilePoller.
    G. From this point on the call sequence can be followed in FilePoller...
    H. The start() method of PollingComponentSupport, will eventually call super.start(), which propagates up to call the start() method of BaseLifeCycle, which sets the component state to "RUNNING."

...