Results 1 to 4 of 4

Thread: Long running Integration process

  1. #1
    Join Date
    Nov 2011
    Location
    Charlotte, NC, USA
    Posts
    21

    Default 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. #2
    Join Date
    Oct 2005
    Location
    Boston, MA
    Posts
    2,854

    Default

    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

  3. #3
    Join Date
    Nov 2011
    Location
    Charlotte, NC, USA
    Posts
    21

    Default

    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!!

  4. #4
    Join Date
    Apr 2009
    Posts
    17

    Default

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •