Search code examples
javaspring-bootspring-integrationspring-integration-dsl

Spring Integration SLA option


I have a springboot integration application that listen for the files in the directory based on some parameter like

startTimeScan
endTimeScan
Days to scan 

I am using Cron expression that works fine but now I have a challenge that some of the clients would have SLA cutoff time basically if the file don't come by that time it will raise an alert.

Is there any option in Spring Integration that kind of provide this feature?


Solution

  • Yes, the AbstractMessageSourceAdvice implementation can be used for such a logic. You just need to implement its afterReceive(Message<?> result, MessageSource<?> source) and check for the message for null. After some period you raise an alert.

    Only the problem that this advice is executed from the polling task, therefore in the interval mentioned by your cron. Unfortunately there is no other way react to the missing event.

    https://docs.spring.io/spring-integration/docs/5.0.8.RELEASE/reference/html/messaging-channels-section.html#conditional-pollers