Spring集成DSL:Dispatcher没有订阅服务器
我需要使用SFTP接收zip文件。我们应该按原样归档文件,并在解压缩zip文件后处理该文件。以下是主流量和副流量的代码。AgentDataArchiveChannel Adapter()工作正常,但对于另一个通道,我发现以下错误。错误可能是什么?如何修复?我的假设是surancebayAgentDemographicFlow()将把记录放入直接通道,并按照所述的过程进行操作Spring集成DSL:Dispatcher没有订阅服务器,spring,spring-integration,spring-integration-dsl,Spring,Spring Integration,Spring Integration Dsl,我需要使用SFTP接收zip文件。我们应该按原样归档文件,并在解压缩zip文件后处理该文件。以下是主流量和副流量的代码。AgentDataArchiveChannel Adapter()工作正常,但对于另一个通道,我发现以下错误。错误可能是什么?如何修复?我的假设是surancebayAgentDemographicFlow()将把记录放入直接通道,并按照所述的过程进行操作 Dispatcher has no subscribers, failedMessage=GenericMessage [
Dispatcher has no subscribers, failedMessage=GenericMessage [payload=C:\thirdparty\input\thirdpartyAL_20180921_215000.zip, headers={file_originalFile=C:\thirdparty\input\thirdpartyAL_20180921_215000.zip, id=1a721c73-92fe-cabc-c8a3-cb71c72ab07d, file_name=thirdpartyAL_20180921_215000.zip, file_relativePath=thirdpartyAL_20180921_215000.zip, timestamp=1537816555968}]
2018-09-24 12:16:22.004 DEBUG 17536 --- [ask-scheduler-2] o.s.i.channel.PublishSubscribeChannel : postSend (sent=true) on channel 'errorChannel', message: ErrorMessage [payload=org.springframework.messaging.MessageDeliveryException: Dispatcher has no subscribers for channel 'application.thirdpartyAgentDemographicFlow-Processing'.; nested exception is org.springframework.integration.MessageDispatchingException: Dispatcher has no subscribers, failedMessage=GenericMessage [payload=C:\thirdparty\input\thirdpartyAL_20180921_215000.zip, headers={file_originalFile=C:\thirdparty\input\thirdpartyAL_20180921_215000.zip, id=1a721c73-92fe-cabc-c8a3-cb71c72ab07d, file_name=thirdpartyAL_20180921_215000.zip, file_relativePath=thirdpartyAL_20180921_215000.zip, timestamp=1537816555968}], failedMessage=GenericMessage [payload=C:\thirdparty\input\thirdpartyAL_20180921_215000.zip, headers={file_originalFile=C:\thirdparty\input\thirdpartyAL_20180921_215000.zip, id=1a721c73-92fe-cabc-c8a3-cb71c72ab07d, file_name=thirdpartyAL_20180921_215000.zip, file_relativePath=thirdpartyAL_20180921_215000.zip, timestamp=1537816555968}], headers={id=9e342354-8436-e1de-774e-937c8b6809d5, timestamp=1537816582001}] for original GenericMessage [payload=C:\thirdparty\input\thirdpartyAL_20180921_215000.zip, headers={file_originalFile=C:\thirdparty\input\thirdpartyAL_20180921_215000.zip, id=1a721c73-92fe-cabc-c8a3-cb71c72ab07d, file_name=thirdpartyAL_20180921_215000.zip, file_relativePath=thirdpartyAL_20180921_215000.zip, timestamp=1537816555968}]
代码/集成流程
@Bean("sftpAgentInboundFlow")
public IntegrationFlow sftpAgentInboundFlow(SessionFactory<LsEntry> sftpSessionFactory) {
return IntegrationFlows
.from(Sftp.inboundAdapter(sftpSessionFactory)
.deleteRemoteFiles(false)
.preserveTimestamp(true)
.remoteDirectory(agentRemoteDir)
.filter(new AcceptOnceFileListFilter<>())
.regexFilter(".*\\.zip$")
.localDirectory(new File(inputDir))
.autoCreateLocalDirectory(true)
.maxFetchSize(1)
,
consumer -> consumer.id("sftpInboundAdapter")
.autoStartup(false)
.poller(Pollers.fixedDelay(scanFrequency,TimeUnit.SECONDS)))
.publishSubscribeChannel(pubSub -> pubSub
.id("AgentInboundDemographic-PubSub-Channel")
.subscribe(flow -> flow.bridge(e -> e.id("ziparchiver")).handle(agentDataArchiveChannelAdapter()))
.subscribe(surancebayAgentDemographicFlow())
)
.get();
}
//@Bean("surancebayAgentDemographicFlow")
public IntegrationFlow surancebayAgentDemographicFlow() {
return IntegrationFlows
//.from(inputFileSource(), spec -> spec.poller(Pollers.fixedDelay(scanFrequency,TimeUnit.SECONDS)/*.maxMessagesPerPoll(corepoolsize)*/))
.from(MessageChannels.direct("thirdpartyAgentDemographicFlow-Processing"))
.transform(unZipTransformer())
.split(splitter())
.channel(MessageChannels.executor(taskExecutor()))
.<File, Boolean>route(f -> f.getName().contains("individual"), m -> m
.subFlowMapping(true, sf -> sf.gateway(individualProcessor()))
.subFlowMapping(false, sf -> sf.gateway(firmProcessor()))
)
.aggregate(aggregator -> aggregator.groupTimeout(messageGroupWaiting).correlationStrategy(new CorrelationStrategy() {
@Override
public Object getCorrelationKey(Message<?> message) {
return "processdate";
}
}).sendPartialResultOnExpiry(true))
.handle("agentDemograpicOutput","generateAgentDemographicFile")
.channel(confirmChannel())
.get()
;
}
@Bean(“sftpAgentInboundFlow”)
公共集成流sftpAgentInboundFlow(会话工厂sftpSessionFactory){
返回积分流
.来自(Sftp.内置适配器(sftpSessionFactory)
.deleteRemoteFiles(错误)
.保留时间戳(true)
.remoteDirectory(agentRemoteDir)
.filter(新的AcceptOnceFileListFilter())
.regexFilter(“.\\.zip$”)
.localDirectory(新文件(inputDir))
.autoCreateLocalDirectory(true)
.maxFetchSize(1)
,
consumer->consumer.id(“sftpInboundAdapter”)
.AutoStart(错误)
.poller(poller.fixedDelay(扫描频率、时间单位、秒)))
.publishSubscribeChannel(pubSub->pubSub
.id(“代理子频道”)
.subscribe(flow->flow.bridge(e->e.id(“ziparchiver”)).handle(agentDataArchiveChannelAdapter())
.subscribe(surancebayAgentDemographicFlow())
)
.get();
}
//@Bean(“surancebayAgentDemographicFlow”)
公共集成流量测量BayAgentDemographicFlow(){
返回积分流
//.from(inputFileSource(),spec->spec.poller(Pollers.fixedDelay(扫描频率,时间单位.秒)/*.maxMessagesPerPoll(corepoolsize)*/)
.from(MessageChannels.direct(“第三方数据流处理”))
.transform(unzipttransformer())
.split(splitter())
.channel(MessageChannels.executor(taskExecutor()))
.route(f->f.getName().contains(“单个”),m->m
.subFlowMapping(true,sf->sf.gateway(individualProcessor()))
.subFlowMapping(false,sf->sf.gateway(firmProcessor()))
)
.aggregate(aggregator->aggregator.groupTimeout(messageGroupWaiting).correlationStrategy(新的correlationStrategy()){
@凌驾
公共对象getCorrelationKey(消息){
返回“processdate”;
}
}).sendPartialResultOnExpiry(真))
.handle(“agentDemographicOutput”、“generateAgentDemographicFile”)
.channel(confirmChannel())
.get()
;
}
好的!我认为问题在于,您使用一些Spring集成版本,其中将外部IntegrationFlow
用作子流的功能尚未实现。或者考虑升级到最新版本或使用一个解决方案作为<代码>订阅(“第三方PARTEGICICIC流程处理”)并取消对surancebayAgentDemographicFlow
定义上的@Bean
注释的注释。根据一个例外情况,问题在于第三方DemographicFlow处理
中没有显示配置中的该部分。因为某种原因不得不改名