Hi Because discarding an exchange was bad in the first place, as it may have some work it was supposed to execute when its done (UnitOfWork). So use it with care to just discard it.
Yes, implement your own logic for what you want to do. On Tue, Aug 15, 2023 at 9:54 PM Schmeier, Jannik <j.schme...@fraport.de> wrote: > Hi, > > I've been using the following code for creating an executor service that > discards the oldest invocations when the queue is full. > > ThreadPoolBuilder poolBuilder = new ThreadPoolBuilder(getContext()); > singleSplitExecutorService = > poolBuilder.poolSize(1).maxPoolSize(1).maxQueueSize(200) > .rejectedPolicy(ThreadPoolRejectedPolicy.DiscardOldest) > .build("singleSplitExecutorService"); > > Then I'm using that executor service in a wiretap: > > > > .wireTap(split(getMessageSplitRouteId())).executorService(singleSplitExecutorService) > > During migrating to Camel 4 I noticed, that Discard and DiscardOldest has > been removed and only Abort and CallerRuns are available now. However with > CallerRuns the ordering of invocations wouldn't be correct anymore in case > the queue is full and with Abort I'd have unwanted exceptions causing our > routes to stop processing data. > > Is there a suggested alternative way to achieve the same functionality? > Why has it been removed from camel in the first place? Java 17 still comes > with a default implementation of the RejectedExecutionHandler for > discarding, so I don't see a reason for that. > > I know that I can create the executor service myself with plain Java, but > I still wanted to ask if I'm missing something in Camel APIs. > > Jannik > > -- Claus Ibsen ----------------- @davsclaus Camel in Action 2: https://www.manning.com/ibsen2