2

I am using spring integration for ftp integration. Following is my config

<int:channel id="ftpChannel"/>

    <int-ftp:outbound-channel-adapter  id="ftpOutbound"
                channel="ftpChannel"
                remote-directory="/"
                session-factory="ftpClientFactory">
        <int-ftp:request-handler-advice-chain>
            <int:retry-advice />
        </int-ftp:request-handler-advice-chain>
    </int-ftp:outbound-channel-adapter>

How do I convert this to java based spring configuration?

hrishikeshp19
  • 8,838
  • 26
  • 78
  • 141

1 Answers1

2

From one side, please, pay attention that we have already Spring Integration Java DSL project and you can find there the FTP test-cases to figure out how to configure the FTP adapter from Java and DSL perspective.

From other side you should take a look to the Spring Integration Reference Manual, Annotation Configuration chapter to figure out what is @ServiceActivator, @Transformer and others. Your particular case may look like:

@Bean
@ServiceActivator(inputChannel = "ftpChannel", adviceChain = "retryAdvice")
public MessageHandler ftpHandler() {
    FileTransferringMessageHandler handler = new FileTransferringMessageHandler(this.ftpClientFactory);
    handler.setRemoteDirectoryExpression(new LiteralExpression("/"))
    return handler;
}

and so on. The retryAdvice in my sample is bean name for the RequestHandlerRetryAdvice.

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
  • What is your recommendation? – hrishikeshp19 Aug 14 '15 at 22:35
  • Thanks for help but this does not really solve my problem. Can you elaborate a bit more? the annotation configuration chapter is a bit complicated for me to understand at this point. – hrishikeshp19 Aug 14 '15 at 22:55
  • Actually, the only Java & Annotation configuration is really complicated and it doesn't depend from that documentation. Especially you shouldn't forget to add `@EnableIntegration` alongside with the `@Configuration` and so on. From other side maybe Java DSL would be simpler for you... – Artem Bilan Aug 15 '15 at 00:18