Versions Compared

Key

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

...

Eventually, one of the threads that is polling (see step g above) for a file in the inbox directory will see a file in the inbox directory. It will use workManager's thread pool to get a thread for processing the file. Processing the file consists of streaming it in from inbox, creating a normalized message, and sending the message to the NMR.

Code Block
titlePollingComponentSupport.java,bar=solid

           timerTask = new TimerTask() {
                public void run() {
                    try {
                        // lets run the work inside the JCA worker pools to ensure
                        // the threads are setup correctly when we actually do stuff
                        getWorkManager().scheduleWork(PollingComponentSupport.this);
                    }
                    catch (Throwable e) {
                        log.error("Failed to schedule work: " + e, e);
                    }
                }
            };
            if (firstTime != null) {
                timer.scheduleAtFixedRate(timerTask, firstTime, period);
            }
            else {
                timer.scheduleAtFixedRate(timerTask, delay, period);
            }
        }
        super.start();

workManager Details

workManager is a property of the FilePoller object. This property is defined by a local reference, the "ref" attribute in the servicemix.xml file. The local reference is a bean which instantiates org.activemq.work.SpringWorkManager.

...