如何在spring sftp入站通道适配器中配置委派会话工厂

时间:2016-01-20 14:19:53

标签: spring spring-integration

我们希望在运行时将session-factory委派给spring sftp入站通道适配器。为此,我们完成了以下配置。

我们已经完成了spring-sftp集成文档,但我们不确定如何通过java设置session-factory属性值。您能否建议我们如何使用委派会话工厂委派spring sftp入站通道适配器中的会话工厂运行时间。

XML配置

ApplicationContext ac = new ClassPathXmlApplicationContext("beans.xml");
DelegatingSessionFactory<String> dsf = (DelegatingSessionFactory<String>) ac.getBean("delegatingSessionFactory");
SessionFactory<String> one = dsf.getFactoryLocator().getSessionFactory("one");
SessionFactory<String> two = dsf.getFactoryLocator().getSessionFactory("two");
dsf.setThreadKey("two");
SourcePollingChannelAdapter spca = (SourcePollingChannelAdapter) ac.getBean("sftpInbondAdapter");
spca.start();

java代码

var something: Int64?

1 个答案:

答案 0 :(得分:0)

委派会话工厂实际上是用于出站适配器和网关。通常,入站适配器不会切换到不同的服务器。

main线程上设置线程密钥,就像什么都不做。

您需要在调用适配器的线程上设置/清除键;这是针对出站适配器in the documentation显示的。

对于入站适配器,您需要在轮询器线程上执行此操作。

我不知道您将选择工厂的标准,但您可以使用smart poller来执行此操作。

相关问题