Versions Compared

Key

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

...

  1. The ServiceMix container reads the servicemix.xml file and sees it needs to instantiate a FilePoller.
  2. The container calls the init() method of FilePoller as well as the init() methods of its parents
  3. The container determines that FilePoller is an MBean and, therefore, calls the start() method of FilePoller, which it inherits from its parent PollingComponentSupport.
  4. The start() method will:
    a. Create a timerTask, which overrides the run() method inline, the run() method will eventually get the WorkManager and schedule work.
    b. 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 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.
    d. timerTask's run method() is defined inline. It will get the workManager object (see below for details).
    e. The workManager will call scheduleWork(PollingComponentSupport.this). Note: it passes in PollingComponent support, which by virtue of its inheritance hierarchy, is also of type "Work", which is a "Runnable."
    f. workManager.scheduleWork(Work) will likely create or get a Thread, passing in a Runnable object, i.e. PollingComponentSupport, and call its run() method
    g. PollingComponent's run() method calls poll(), which is implemented in FilePoller.
    h. From this point on the call sequence can be followed in FilePoller...
    i. The start() method of PollingComponentSupport, will eventually calls super.start(), which propagates up to call the start() method of BaseLifeCycle, which sets the component state to "RUNNING."

_workManager Details

Work manager is used in two ways:

When the application is run, it has an inbox and outbox. Each instance of the application may move files between different source and destination directories, i.e. a different inbox and outbox as specified in its own workManager is a property of the FilePoller object. This property is defined by a local reference, the "ref" attribute in the servicemix.xml file. Each The work manager will allocate a thread for each instance of the application.The local reference is a bean which instantiates org.activemq.work.SpringWorkManager.

The spring workmanager is a spring bean, which by default, when a spring bean starts the properties are set, which are defined in the service.xml file. A method called "afterpropertiesset" is called by the container

The SprintWorkManager is used in two ways:

The work manager will also allocate a thread to process one file (read, normalize and send to NMR). The work manager calls a scheduleWork method with is non-blocking. Therefore, if multiple files need to be processes, filePoller can continue making request to the work manager to schedule work.

...

which was defined in the servicemix.xml and "given" to the filePoller.

Workmanager is a property of the filePoller object. This property is actually given a local reference to a bean, which is defined in the same xml file (the workmanager is an org.activemq.work.springworkmanager type

The spring workmanager is a spring bean, which by default, when a spring bean starts the properties are set, which are defined in the service.xml file. A method called "afterpropertiesset" is called by the container

Related Documentation

For more information on the following topics please see:

...