以编程方式启动和停止 Spring Integration 中的某些 IntegrationFlows?

Joh*_*han 3 java spring spring-integration

我在 spring 集成中创建了一些 IntegrationFlow,如下所示:

IntegrationFlows.from(..).id("test").autoStartup(false). ..
Run Code Online (Sandbox Code Playgroud)

如何在 Spring Integration 中查找此集成流程并启动它?我正在寻找类似于org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistry可用于启动和停止RabbitListener实例的东西。

Gar*_*ell 5

使用流的 bean 名称

@Bean
public IntegrationFlow flow() {...}


...


@Autowired
public IntegrationFlow flow;

...

flow.stop();
Run Code Online (Sandbox Code Playgroud)

(或getBean("flow")ApplicationContext)。