JonathanVila
JonathanVila

Reputation: 189

Trigger an action when the number of success messages gets a certain number using Spring Integration

We have an operation that have to be triggered when a certain number of messages have been sent in a Spring Integration pipeline.

In fact when the sum of Discarded Messages plus Successfully sent messages plus Error sent messages ( in a HttpComponentsMessageSender ) arrive to a certain number.

I've seen there is something called "" that stores the metrics, but how to trigger something based on its numbers ?

Upvotes: 1

Views: 94

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121272

Looks like an Aggregator EI pattern is fully for you:

http://www.enterpriseintegrationpatterns.com/patterns/messaging/Aggregator.html http://docs.spring.io/spring-integration/reference/html/messaging-routing-chapter.html#aggregator

So, you correlate all those messages with some correlationStrategy. The custom releaseStrategy decides if a condition for all messages in that group has been met and you produce a message from that aggregator to some channel for performing a desired trigger action.

Upvotes: 2

Related Questions