My user has a UI that shows all messages that have been processed by or are
currently being processed by the Camel API.  During the time a message is in
process they want to be able to cancel the message.  In the application I
have code in a rest service that is called by the UI.  It contains:


public void cancelExchange(String exchangeId) {
        synchronized (this.camelContext) {
            // Get a list of all in flight exchanges with the passed in
exchangeId
            final List<Exchange> exchanges =
this.camelContext.getInflightRepository().browse().stream().filter(inflightExchange
-> inflightExchange.getExchange().getExchangeId().equals(exchangeId))
                   
.map(InflightRepository.InflightExchange::getExchange).collect(Collectors.toList());

            // Remove any active exchanges from Camel
            for (final Exchange exchange : exchanges) {
                this.log.debug("Removing exchange {}",
exchange.getExchangeId());

                this.camelContext.getInflightRepository().remove(exchange);

                // Set the ROUTE_STOP property so Camel will try to stop the
Exchange on the next
                // retry
                exchange.setProperty(Exchange.ROUTE_STOP, Boolean.TRUE);
            }
    }

This is not working.  I identified an endpoint that is refusing connections. 
It goes through the re-delivery tries and eventually fails.  What do I need
to do to tell Camel to drop that message?



--
View this message in context: 
http://camel.465427.n5.nabble.com/Cancelling-messages-tp5791836.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to