Hi That is what JMS has with message groups https://activemq.apache.org/message-groups
On Thu, Sep 8, 2022 at 4:07 AM Mansour Al Akeel <mansour.alak...@gmail.com> wrote: > I have a stream of commands that needs to be processed in parallel for > performance reasons, and to be grouped on a key for sequential processing > to avoid conflicts. > > I don't know the number of groups in advance. One way that came to my mind, > is dynamic channels/queues. So the stream of commands is sorted into > queues, where each queue represents a group. Then handle those > sequentially. > > I have been looking at toD, and dynamic router, but no luck. > I am hoping to be able to achieve something like: > > from("direct:commands") > .to("direct:${header.groupId}) > .process(new MyProcessor()) > > > Therefore processing commands in parallel, across all queues, while > blocking on the same queue. > If an error occurs, during the process of a command, I would like to be > able to flush/return the failed, and all the pending ones. In other words, > empty the queue. > > > How to achieve this ? > I am open for advice about better ideas/setup. > -- Claus Ibsen ----------------- http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2