I'm using a Spring Integration (4.1) config to retrieve message from DB as a batch more than as a service. I know I'll have a dozen of messages to process daily, and therefore I need to run the batch once a day.
My jdbc:inbound-channel-adapter is configured to retrieve max-rows-per-poll="1". I'd like to be notified in some way when there are no more messages, so that I can exit the batch, but I have issues finding where to "plug". I tried with an interceptor that remembers when last message went through + a scheduled task that retrieves that timestamp and checks if it's more than a configured timeout, but it felt very cumbersome and tried with AOP instead, which feels like a better solution.
I'd like to intercept the call to AbstractPollingEndpoint.doPoll() which returns false when there's no message but I'm not able to find a way to do that : I tried subclassing AbstractRequestHandlerAdvice but that doesn't work when applied on a poller (it tells me so in the logs). Now I'm trying to implement MethodInterceptor and configure as below, and I see I can intercept the call to "call" method, but I'm not sure it's the right way
<int:poller default="true" trigger="periodicTriggerWithInitialDelay">
<int:advice-chain>
<bean class="com.myBatch.NoMoreMessageNotifierAdvice" />
<ref bean="txAdvice"/>
</int:advice-chain>
</int:poller>
Isn't there an easier way to do this ? The main difficulty, as stated here http://forum.spring.io/forum/spring-projects/integration/127410-poller-with-advice-chain , is that at this stage, we don't have message to work on.
Thanks
Vincent