Hi,
My requirement is to do a simple FTP download of a file from a FTP server, process it then upload response file to the same server and then I am done. I have setup an inbound and outound ftp channel adapter. Configurations are
Inbound:
Code:
<bean id="ftpClientFactory" class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory">
<property name="host" value="${cjserver.host}"/>
<property name="port" value="${cjserver.port}"/>
<property name="username" value="${cjserver.username}"/>
<property name="password" value="${cjserver.password}"/>
</bean>
<int-ftp:inbound-channel-adapter id="ftpInbound"
channel="receiveChannel"
session-factory="ftpClientFactory"
filename-pattern="${inbound.filename}"
auto-create-local-directory="true"
delete-remote-files="false"
remote-directory="${cjserver.inbound.dir}"
local-directory="${local.dir}">
<int:poller fixed-rate="1000"/>
</int-ftp:inbound-channel-adapter>
<int:channel id="receiveChannel" />
<int:control-bus input-channel="operationChannel"/>
Outbound:
Code:
<bean id="ftpClientFactory" class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory">
<property name="host" value="${cjserver.host}"/>
<property name="port" value="${cjserver.port}"/>
<property name="username" value="${cjserver.username}"/>
<property name="password" value="${cjserver.password}"/>
</bean>
<int:channel id="outputChannel" />
<int-ftp:outbound-channel-adapter id="ftpOutbound" cache-sessions="false"
channel="outputChannel"
remote-directory="${cjserver.outbound.dir}"
session-factory="ftpClientFactory" />
I am running a java main program and see that the process does not terminate even after execution of the program. Guess a thread is started by the <int
oller fixed-rate="1000"/>. I need my progarm to terminate completly once I process the file. Any suggestions of how to achieve this please ?
I have tried this to stop the inbound channel adapter, but that stops the polling , but my process did not exit.
Code:
@Resource(name="operationChannel")
private DirectChannel controlBusChannel;
and then call
Message<String> operation = MessageBuilder.withPayload("@ftpInbound.stop()").build();
controlBusChannel.send(operation);