Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Integration debounce/deduplicate

Is there some component in Spring Integration that could be used to filter out duplicates in a specified time frame?

I am looking for something like Debounce from ReactiveX

In my project I am sending a Payload containing a UUID and I want to filter out multiple Payloads with the same UUID if the are sent through the queue within 10 seconds for example - then I want to only let the last on through as long as no other Payload with the same UUID comes within the next 10 seconds.

like image 960
Thomas Einwaller Avatar asked Jun 25 '26 15:06

Thomas Einwaller


1 Answers

You can use an aggregator for that purpose. What you would need set up is

  • the correlation strategy to recognize messages that are duplicated
  • the release strategy to consider a single message to be a completed group
  • expire-groups-upon-completion to false, so that the group will not be deleted as soon as it is completed and sent out
  • group-timeout to, for example, for 10 seconds
  • keep expire-groups-upon-timeout as true (it is so by default)

From the reference documentation:

(expire-groups-upon-completion) When set to true (default false), completed groups are removed from the message store, allowing subsequent messages with the same correlation to form a new group. The default behavior is to send messages with the same correlation as a completed group to the discard-channel.

like image 125
Apokralipsa Avatar answered Jun 28 '26 04:06

Apokralipsa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!