2017-11-11 130 views

回答

0

您需要顯示您的配置,但通常您要停止引用源的SourcePollingChannelAdapter來停止適配器。您不想取消訂閱,除非適配器停止,否則會導致錯誤。

編輯

您的配置,如果入站適配器是在一個名爲IntegrationCongfig類,它的bean名字會integrationConfig.test.inboundChannelAdapter(注意小寫i)...

@Autowired 
@Qualifier("integrationConfig.test.inboundChannelAdapter") 
private SourcePollingChannelAdapter test; 

@Autowired 
private StandardIntegrationFlow processFileFlow; 

.. 。

this.test.stop();    // stop the adapter 
this.processFileFlow.stop(); // stops all components in the flow 

停止流程將取消訂閱處理程序e頻道;但你必須先停止適配器。

+0

這裏是我的配置:@Bean \t公共MessageChannel fileInputChannel(){返回新DirectChannel();} // @豆 \t公共IntegrationFlow processFileFlow(){回報IntegrationFlows \t。從 「fileInputChannel」 \t .handle(」 incomingFileProcessor「,」validateAndStartJob「)。get(); \t} @Bean \t @InboundChannelAdapter(值= FILE_INPUT_CHANNEL,輪詢器= @Poller(FIXEDDELAY = _1000)) 公共FileReadingMessageSource試驗(@Value( 「$ {dirPath}」)字符串目錄){返回monitorDirectory(目錄);} – ram533

+0

不要在評論中放置代碼;你可以看到它很難閱讀;在將來,編輯問題,並添加一個你已經這樣做的評論。看到我的答案編輯。 –