I guess the biggest thing I need to accomplish is telling all the exchanges 
that are stopped to go to the next endpoint.

Is there something I can append like a property that says: "exchange.set 
property(Exchange.goToEndpoint, "database")"?


"doug5791 [via Camel]" <ml-node+s465427n5749356...@n5.nabble.com> wrote:

I am currently trying to use the "Exchange.ROUTE_STOP" property -I do not think 
that using a CountDownLatch will work out-, however I do not get the desired 
effect. Using the code below, only the last Exchange goes on to the database:


//exAr is a List of Exchanges
.process(new Processor()
                        {
                        public void process(Exchange exchange) throws Exception
                                {
                        //Check if cache is not full, add the exchange, set 
exchange to stop
                        if(exAr.size() < CACHEMAXSIZE)
                        {
                        exAr.add(exchange);
                        cacheSize++;
                        exchange.setProperty(Exchange.ROUTE_STOP, Boolean.TRUE);
                        }

                        //Check if cache is full, iterate exchanges and set to 
go, clear cache
                        if(exAr.size() == CACHEMAXSIZE)
                        {
                        for(int i = 0; i < CACHEMAXSIZE; i++)
                        {
                        exAr.get(i).setProperty(Exchange.ROUTE_STOP, 
Boolean.FALSE);
                        }
                        cacheSize = 0;
                        exAr.clear();
                        }
                        }
                        })
                        .to("database")
According to the documentation on using ROUTE_STOP this should be what I'm 
looking for. However only the last item in the List is sent on to the database.

________________________________
If you reply to this email, your message will be added to the discussion below:
http://camel.465427.n5.nabble.com/Camel-How-to-stop-a-route-temporarily-tp5749351p5749356.html
To unsubscribe from Camel: How to stop a route temporarily?, click 
here<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5749351&code=dG9iZWRhMjFAdXdnYi5lZHV8NTc0OTM1MXwxNzM2OTQ0MzM3>.
NAML<http://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




--
View this message in context: 
http://camel.465427.n5.nabble.com/Camel-How-to-stop-a-route-temporarily-tp5749351p5749360.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to