onkami
onkami

Reputation: 9431

Start Spring Integration route on demand, not during context initialization

I have a Spring Integration route (made via DSL) that polls the files from a specific folder (as shown in Polling from file using Java DSL - compile error when adding Files.inboundAdapter) and sends to Rabbit.

When I configured the flow as explained in the link above, it starts on configuration stage already. I, however, would like to start it in runtime, later, since I need to connect to Rabbit first.

How can I configure IntegrationFlow to be started/stopped later on demand?

Upvotes: 0

Views: 394

Answers (1)

Gary Russell
Gary Russell

Reputation: 174729

Add autoStartup(false).

e -> e.poller(Pollers.fixedDelay(5000))
      .autoStartup(false)

then flow.start() when you are ready.

Upvotes: 2

Related Questions