Re: Cancelling messages

2016-12-23 Thread Claus Ibsen
Try setting InterruptedException as exception on the cancelled
exchange as well, this should be detected by the redelivery error
handler and break out.

On Wed, Dec 21, 2016 at 10:30 PM, Glenn Puckett <gpuck...@savi.com> wrote:
> 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 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.



-- 
Claus Ibsen
-
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2


Cancelling messages

2016-12-21 Thread Glenn Puckett
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 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.