Results 1 to 4 of 4

Thread: FTP Inbound Channel Adapter threads

  1. #1
    Join Date
    Jan 2012
    Posts
    21

    Default FTP Inbound Channel Adapter threads

    I'm using the following ftp inbound channel adapter from spring-integration-ftp 2.1.4.RELEASE:

    Code:
    <int-ftp:inbound-channel-adapter id="ftpInboundAdapter"
    		channel="ftpInChannel"
    		session-factory="ftpSessionFactory"
    		local-directory="file:/ftp_temp"
    		local-filename-generator-expression="#this + '_temp.txt'"
    		remote-directory="Inventory/Transform"
    		filename-pattern="*_RESPONSE.txt"
    		delete-remote-files="true"
    		>
    		<int:poller fixed-rate="60000" />
    	</int-ftp:inbound-channel-adapter>
    I've noticed that 10 task-scheduler threads are being created, I assume for the poller. The initial poll happens on the first thread, each subsequent poll creating another thread, until it hits 10 threads. At that point, it seems the polling all happens on the same thread. This seems sub-optimal. Is there a reason this is happening, or is something else creating the task-scheduler threads?

  2. #2
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,025

    Default

    Not sure why you say it's suboptimal; anyway, yes, the default taskScheduler has 10 threads. If you wish to override it, simply create a <task:scheduler /> with the same Id and configure it as you wish.

    http://static.springsource.org/sprin...-taskscheduler
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

  3. #3
    Join Date
    Jan 2012
    Posts
    21

    Default

    Is the task scheduler just used for polling, or is the message processed (i.e. via a service activator on the destination channel) on the same thread? The thread pool makes sense to me if message processing happens on the thread. I assumed the thread pool was dedicated just to polling, and couldn't imagine why you'd want to concurrently poll a message source...

  4. #4
    Join Date
    Mar 2010
    Location
    Gtr Philadelphia, PA
    Posts
    2,025

    Default

    You can configure it however you want. By default, the poller uses a SyncTaskExecutor, which means a message received from the source (in your case a FileReadingMessageSource) is processed on the scheduler's thread directly. However, you can add a task-executor to the poller, in which case the scheduler thread hands the work off to the task executor's thread to process the message.
    Gary P. Russell
    Spring Integration Team
    SpringSource, a division of VMware

Posting Permissions

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