Spring integration Poller is not polling files which are coming to directory after application has started
<p>I have a spring batch-integration application where SI part reads a folder for files and invokes the spring job for that file. Now when i start my application it reads all the files available in the folder but if any file comes after the application started, poller doesn't pick that file. below is my code for the same </p>

<p>config</p>

<pre><code>&lt;int:poller id="appPoller" 
default="false" 
fixed-rate="1000"  
max-messages-per-poll="1" &gt;
    &lt;int:advice-chain&gt;
&lt;ref bean="inputDirChangeAdvice"/&gt; 
&lt;/int:advice-chain&gt;

&lt;/int:poller&gt;
&lt;bean id="inputDirChangeAdvice" class="com.varun.processor.ChangeDirAdvice" /&gt;
&lt;int:channel id="files"/&gt;

&lt;int:channel id="requests"/&gt;

&lt;int:channel id="statuses"&gt;
    &lt;int:queue capacity="10"/&gt;
&lt;/int:channel&gt;

&lt;int-file:inbound-channel-adapter   id="pollAppFiles"
                                    prevent-duplicates="true"
                                    ignore-hidden="true"
                                    directory="file:/"
                                    filename-pattern="*.DAT"
                                    channel="files"&gt;
                                    &lt;int:poller ref="appPoller"/&gt;
                                &lt;int-file:locker ref="appLocker"/&gt;
&lt;/int-file:inbound-channel-adapter&gt;
&lt;bean id="appLocker" class="com.varun.locker.APPFileLocker" /&gt;

&lt;int:transformer id="prepareJobLaunchRequest"
    input-channel="files" output-channel="requests"&gt;
    &lt;bean class="com.varun.transformer.FileMessageToJobRequest"&gt;
        &lt;property name="job" ref="JobName"/&gt;
        &lt;property name="fileParameterName" value="AbsoluteInputFile"/&gt;
    &lt;/bean&gt;
&lt;/int:transformer&gt;

&lt;int:service-activator id="runJob" method="launch" input-channel="requests"
    output-channel="statuses"&gt;
    &lt;bean class="org.springframework.batch.integration.launch.JobLaunchingMessageHandler"&gt;
        &lt;constructor-arg ref="jobLauncher"/&gt;
    &lt;/bean&gt;
&lt;/int:service-activator&gt;    
</code></pre>

<p>I am using advice on poller so that poller read from dynamic location depending on some condition. </p>

<p>Update:</p>

<p>Advice code as below</p>

<pre><code>public class ChangeDirAdvice extends AbstractMessageSourceAdvice {

@Autowired
@Qualifier("pollAppFiles.source")
private FileReadingMessageSource fileReadingMessageSource;


@Override
public boolean beforeReceive(MessageSource&lt;?&gt; source) {
    //calculate Dynamic directory location
    this.fileReadingMessageSource.setDirectory(newDirectory);
    return true;
}

@Override
public Message&lt;?&gt; afterReceive(Message&lt;?&gt; result, MessageSource&lt;?&gt; source) {
    // TODO Auto-generated method stub
    return result;
}
</code></pre>