1
votes

I need to make a small Spring Integration application that synchronize a table from a JDBC source to another one, and I just need to launch that script just once in a while.

I'd like to make one poll from the inbound channel adapter (wait that the message flow through the chain) and exit the application.

I couldn't find any obvious way to do that: any suggestions?

1
thanks Steve for pointing out the right solution!Gibraltar

1 Answers

6
votes

@Steve suggests correct solution.

You should make your <poller> with some long fixed-delay do not start a new polling task. Or just stop an <inbound-channel-adapter> just after the polling task is run. For this purpose there is just enough make the channel as <publish-subscribe-channel> and add one more subscriber like:

<outbound-channel-adapter channel="processChannel" expression="@adapter.stop()">

So, this is the first part: How to make only the single poll?

Re. System.exit().

You should add in the end of your flow similar outbound-channel-adapter:

<outbound-channel-adapter channel="endProcessChannel" expression="T(System).exit()">