Announcement Announcement Module
No announcement yet.
Long running Integration process Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Long running Integration process


    I've recently created an Integration project that is basically polls a network directory for files and routes them to different web services based upon their content. I have my poller set to check for new files every 30 seconds and things work well.

    What I'd like to know is - what's the best way to make this a long running process?

    I basically want to kick this Integration process off manually, and let the process poll for files every 30 seconds until I manually stop the process, say a month later.


  • #2

    You can call stop on the File-polling adapter at any point (and likewise call start to resume polling). You can have another bean that references the adapter by id, or you can even use the Control Bus to send a message whose payload is something like: "@yourAdapter.stop()" (see the "control bus" section of the reference manual for more detail).

    Hope that helps.


    • #3
      Hi Mark:
      Im talking more about the Java class that basically contains my spring integration context.

      I googled a little more and found an example where the SI context was loaded in a main() method and subsequently closed when a user pressed the enter key. Until the user pressed the enter key, SI would basically be running!!

      I'm wondering what other approaches other developers are using to contain long running Spring Integration programs?


      I didn't realize you could stop a poller via messaging too; that's good info!!


      • #4
        I'll give you the way we do it. Not necessarily the best option, but seems to cover most bases.

        After the SI context is loaded in our main() method, the code uses a simple Semaphore to lock the main thread. We expose other ways to release the Semaphore lock - a shutdown hook on the Runtime and also by registering an MBean exposing a method that does it, so we can use JMX to stop the process.

        The shutdown hook allows us to capture a kill signal to the process and also allows a script to 'stop' the process by issuing a kill on process id.

        Once the Semaphore is unlocked, the main method continues, shutting down the SI context cleanly.