camel-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Terral Guillaume (JIRA)" <>
Subject [jira] [Created] (CAMEL-8914) Unable to shutdown endpoint when intercepted with interceptSendToEndpoint
Date Mon, 29 Jun 2015 07:50:04 GMT
Terral Guillaume created CAMEL-8914:

             Summary: Unable to shutdown endpoint when intercepted with interceptSendToEndpoint
                 Key: CAMEL-8914
             Project: Camel
          Issue Type: Bug
    Affects Versions: 2.15.2
            Reporter: Terral Guillaume

I'm facing an issue with the version of camel 2.15.2 

I have a component that create an endpoint. 

This endpoint override the shutdown and doShutdown method so we can log values at shutdown

But when this endpoint is intercept with the interceptSendToEnpoint method the shutdown is
not called. 

Here is an example of code to reproduce: 

the Component: 
public class CustomComponent extends DefaultComponent {

        protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object>
parameters) throws Exception {
            return new CustomEndpoint();

the Endpoint: 
    public class CustomEndpoint extends DefaultEndpoint {

        public Producer createProducer() throws Exception {
            return new DefaultProducer(this) {
                public void process(Exchange exchange) throws Exception {

        public Consumer createConsumer(Processor processor) throws Exception {
            return null;

        public boolean isSingleton() {
            return false;

        public void shutdown() throws Exception {

        protected void doShutdown() throws Exception {
            System.out.println("do SHUTDOWN");

        protected String createEndpointUri() {
            return "myEndpoint";

the route: 
public class MyRoute extends RouteBuilder {

        public void configure() {
            try {
                getContext().addComponent("myEndpoint", new CustomComponent());
            } catch (Exception e) {

            from("direct:murex").routeId("Trade Repository Route")

When there is an interceptor the shutdown on the endpoint is not called, when there is no
interceptor the shutdown is called. 

After some debugging I noticed that in the DefaultCamelContext at the shutdown time the shutdown
is called on the list of endpoints, when there is an interceptor the list do not contain the
CustomEnpoint but only the Interceptor, and because the interceptor does not implement ShutdownableAware
the shutdown is not propagate to the underlying endpoint (here the CustomEndpoint) 

Without the interceptor the CustomEndpoint appears in the list and the shutdown method is

This message was sent by Atlassian JIRA

View raw message