Freeman Yue Fang created CAMEL-14368:
----------------------------------------

             Summary: can't gracefully shutdown a camel-undertow consumer 
endpoint
                 Key: CAMEL-14368
                 URL: https://issues.apache.org/jira/browse/CAMEL-14368
             Project: Camel
          Issue Type: Bug
            Reporter: Freeman Yue Fang


For example if we have a camel-undertow consumer endpoint like
{code}
               <route id="counter-route">
                        <from uri="undertow:http://0.0.0.0:8080/srv/count"/>
                        <process ref="counterProcessor"/>
                </route>
{code}
and the the counterProcessor is like
{code}
public class CounterProcessor implements Processor {
        private static final transient Logger LOG = 
LoggerFactory.getLogger(CounterProcessor.class);

        public void process(Exchange exchange) throws Exception {
                Long count = 0L;
                if (exchange.getIn().getHeader("count", Long.class) != null) {
                        count = exchange.getIn().getHeader("count", Long.class);
                }
                String cid = exchange.getIn().getHeader("cid", String.class);
                Long delay = 0L;
                if (exchange.getIn().getHeader("delay", Long.class) != null) {
                        delay = exchange.getIn().getHeader("delay", Long.class);
                }

                Long c = count + 1;

                LOG.info("count before delay {} {}", cid, c);
                Thread.sleep(delay == null ? 0 : delay);
                LOG.info("count after delay {} {}", cid, c);

                exchange.getOut().setBody(UuidBean.uuid() + " " + c);
        }
}
{code}

If we send http request with url like
{code}
http://localhost:8080/srv/count?count=5&cid=42&delay=20000
{code}
This suppose to return in 20 sec. If we use "kill -15 process_id_camel_route",  
we should wait and see this camel route gracefully shutdown and let the flight 
exchange finish. But it's not this case now, while with camel-jetty, it works 
as expected.




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to