[
https://issues.apache.org/jira/browse/CAMEL-11124?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15962120#comment-15962120
]
Claus Ibsen commented on CAMEL-11124:
-------------------------------------
Added new exception ReactiveStreamsDiscardedException which you can then ignore
by
{code}
// just ignore discarded streams by marking them as handled
onException(ReactiveStreamsDiscardedException.class).handled(true);
{code}
> camel-reactive-streams - Allow to silently ignore discarded messages
> --------------------------------------------------------------------
>
> Key: CAMEL-11124
> URL: https://issues.apache.org/jira/browse/CAMEL-11124
> Project: Camel
> Issue Type: Improvement
> Components: camel-reactive-streams
> Affects Versions: 2.19.0
> Reporter: Claus Ibsen
>
> If you want to discard messages and use a policy of
> {code}
> .to("reactive-streams:inbox?backpressureStrategy=LATEST");
> {code}
> Then Camel will thrown an exception if its discarded
> {code}
> java.lang.IllegalStateException: Exchange
> Exchange[ID-davsclaus-air-52789-1491737146614-0-450] discarded by
> backpressure strategy LATEST
> at
> org.apache.camel.component.reactive.streams.engine.CamelSubscription.publish(CamelSubscription.java:235)
> at
> org.apache.camel.component.reactive.streams.engine.CamelPublisher.publish(CamelPublisher.java:98)
> at
> org.apache.camel.component.reactive.streams.engine.DefaultCamelReactiveStreamsService.sendCamelExchange(DefaultCamelReactiveStreamsService.java:123)
> at
> org.apache.camel.component.reactive.streams.ReactiveStreamsProducer.process(ReactiveStreamsProducer.java:44)
> at
> org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)
> at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:541)
> at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198)
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:120)
> at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)
> at
> org.apache.camel.processor.DelayProcessorSupport.processDelay(DelayProcessorSupport.java:100)
> at
> org.apache.camel.processor.DelayProcessorSupport.process(DelayProcessorSupport.java:168)
> at
> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:541)
> at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198)
> at
> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:198)
> at
> org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:298)
> at
> org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:207)
> at
> org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:154)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
> {code}
> Which is likely not something you want as you told it to just keep latest.
> We should allow the user to deal with the discarded messages if he/she needs
> to in some other way.
> And we should maybe also keep runtime statistics of the number of discarded
> messages so this can be used for monitoring.
> Also we should introduce a specific CamelReactiveException so you can
> configure Camels error handler to react on it.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)