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

  • Long running Integration process

    Hi:

    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.

    Chris

  • #2
    Chris,

    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.
    -Mark

    Comment


    • #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?

      -Chris

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

      Comment


      • #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.

        Comment

        Working...
        X