问题
Using Java Configuration how to start/stop the Inbound Channel adapter,I tried using control bus But i wasn't sucessful ,Please provide an example with java configuration .
回答1:
The @InboundChannelAdapter populates SourcePollingChannelAdapter bean with the name based on the pattern [configurationComponentName].[methodName].[decapitalizedAnnotationClassShortName]. For example:
@Configuration
@EnableIntegration
public class MyConfiguration {
@InboundChannelAdapter(channel = "inputChannel")
@Bean
public MessageSource<String> myMessageSource() {
return () -> new GenericMessage<>("bar");
}
}
will have a bean name as myConfiguration.myMessageSource.inboundChannelAdapter.
The SourcePollingChannelAdapter is indeed Lifecycle and can be managed by the Control Bus:
controlBusChannel.send(
new GenericMessage("@'myConfiguration.myMessageSource.inboundChannelAdapter'.stop()"));
来源:https://stackoverflow.com/questions/45440330/is-there-a-way-to-stop-the-inbound-channel-adapter-after-files-are-received-from