Search code examples
spring-integrationspring-amqp

Spring Integration - Aggregating Priority Channel


I used Aggregator in spring integration and saw also that there is PriorityChannel. Is there possibility to use two of these somehow to achieve following requirements:

  1. Messages are received from RabbitMQ and stored in spring component that has aggregator
  2. Aggregator is doing aggregation but at a same time it prioritizes messages for release based on some complex sorting algorithm.
  3. As the time passes by, message priorities inside queue can change, and we need to be able to re-schedule priorities at some point in time.

Solution

  • The PriorityChannel won't help with that, but you can do whatever you want in a custom ReleaseStrategy...

    @FunctionalInterface
    public interface ReleaseStrategy {
    
        boolean canRelease(MessageGroup group);
    
    }