0
votes

We use int-ftp:inbound-channel-adapter with fixed rate poller. For maintenance purpose we want the ability to stop the poller when ever needed(using a url). We use the below adapter configuration.

<int-ftp:inbound-channel-adapter id="inboundAdapter"
        channel="inputChannel" session-factory="sessionFactory"
        charset="UTF-8" auto-create-local-directory="false"
        delete-remote-files="true" filename-regex="^.*\.(txt|in)$"
        remote-directory="${remote.directory}" local-directory="${local.directory}">
        <poller max-messages-per-poll="-1" fixed-rate="3000" error-channel="errorChannel"/>
    </int-ftp:inbound-channel-adapter>

Below is the behavior we need to add to this adapter.

  1. We want to continue doing the fixed rate polling
  2. We don't want to keep the files staged in local directory at any moment, local directory is a cloud container location
  3. When we hit a url, the poller should not honor the fixed rate polling( which means, do not pull files from remote directory to local directory) but any staged files in local directory should be processed completely
  4. We need another handler to start the poller back with the fixed rate polling

Any suggestions to modify the adapter for achieving this is helpful.

1

1 Answers

0
votes

To achieve this, set the output channel of the adapter to nullChannel.

Add a <file:inbound-channel-adapter/> to poll the local directory.

Stop the poller for the ftp adapter and the remote fetches will stop (after the current poll completes, if in process), but the file adapter will continue to poll the local directory.

To stop/start the ftp adapter, either @Autowired the SourcePollingChannelAdapter or use a control bus.