Mark1234
Mark1234

Reputation: 619

How to run two inbound adapters in mutually exclusive fashion

enter image description hereI have two inbound-channel-adapter in my SI application, both of them feeding same output channel, which is than subsequently processed through a series of other SI components.

First adapter runs every 10 minute while the second one is event based and can run anytime (in fact polls every 100 msec for new events).

I would like both of these adapters to run one at a time. So for example, if the first one is running and its output is being processed the second adapter should wait for the first adapter (hence its transaction) to complete. Is there any built in mechanism in SI that i can use to achieve this behavior?

Upvotes: 1

Views: 91

Answers (1)

Gary Russell
Gary Russell

Reputation: 174719

You should be able to use a task executor on the <poller/>s, with a single thread (e.g. a ThreadPoolTaskExecutor with a pool size of 1), and a CallerBlocksPolicy in its rejectedExecutionHandler and a queue size of 1.

A queue size of 0 with the default ABORT policy should work too.

Upvotes: 1

Related Questions