Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically start and stop certain IntegrationFlows in Spring Integration?

I've created some IntegrationFlow's in spring integration like this:

IntegrationFlows.from(..).id("test").autoStartup(false). ..

How can I lookup this integration flow in Spring Integration and start it? I'm looking for something similar to org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistry that can be used to start and stop RabbitListener instances.

like image 207
Johan Avatar asked May 10 '26 08:05

Johan


1 Answers

Use the bean name of the flow

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


...


@Autowired
public IntegrationFlow flow;

...

flow.stop();

(or getBean("flow") on the ApplicationContext).

like image 66
Gary Russell Avatar answered May 11 '26 21:05

Gary Russell