ServiceMix Components
  1. ServiceMix Components
  2. SMXCOMP-260

Change endpoints lifecycle to use activate / start / stop / deactivate

    Details

      Description

      Change servicemix-common in the following way:

      • refactor the existing start / stop method into init / shutdown (along with the doStart and doStop methods)
      • add new start / stop methods with empty implementation in the Endpoint class
      • use these new init / start / stop / shutdown lifecycle in the service unit
      • implement start / stop for the polling endpoints
      • implement start / stop for the jms consumer endpoint (it should start / stop the listener container)
      • implement start / stop for the http consumer (a stopped endpoint should return an 503 Service Unavailable http status code)

        Issue Links

          Activity

          Hide
          Guillaume Nodet added a comment -

          No, there are incompatible changes, so we can't backport this stuff.

          Show
          Guillaume Nodet added a comment - No, there are incompatible changes, so we can't backport this stuff.
          Hide
          Ron Gavlin added a comment -

          Is it possible to backport this commit too SMX 3.2.x or is it too big and/or risky to do so?

          Show
          Ron Gavlin added a comment - Is it possible to backport this commit too SMX 3.2.x or is it too big and/or risky to do so?
          Hide
          Guillaume Nodet added a comment -

          Note that the following commits do not enable waiting for all exchanges to be processed when deactivating the endpoint

          Sending servicemix-common/pom.xml
          Sending servicemix-common/src/main/java/org/apache/servicemix/common/AbstractDeployer.java
          Sending servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java
          Sending servicemix-common/src/main/java/org/apache/servicemix/common/BaseComponent.java
          Sending servicemix-common/src/main/java/org/apache/servicemix/common/BaseServiceUnitManager.java
          Sending servicemix-common/src/main/java/org/apache/servicemix/common/DefaultBootstrap.java
          Sending servicemix-common/src/main/java/org/apache/servicemix/common/DefaultComponent.java
          Adding servicemix-common/src/main/java/org/apache/servicemix/common/DefaultServiceUnit.java
          Sending servicemix-common/src/main/java/org/apache/servicemix/common/Endpoint.java
          Sending servicemix-common/src/main/java/org/apache/servicemix/common/EndpointDeliveryChannel.java
          Sending servicemix-common/src/main/java/org/apache/servicemix/common/ExchangeProcessor.java
          Sending servicemix-common/src/main/java/org/apache/servicemix/common/Registry.java
          Sending servicemix-common/src/main/java/org/apache/servicemix/common/ServiceMixComponent.java
          Sending servicemix-common/src/main/java/org/apache/servicemix/common/ServiceUnit.java
          Adding servicemix-common/src/main/java/org/apache/servicemix/common/endpoints/AbstractEndpoint.java
          Sending servicemix-common/src/main/java/org/apache/servicemix/common/endpoints/ConsumerEndpoint.java
          Sending servicemix-common/src/main/java/org/apache/servicemix/common/endpoints/ProviderEndpoint.java
          Sending servicemix-common/src/main/java/org/apache/servicemix/common/endpoints/SimpleEndpoint.java
          Sending servicemix-common/src/main/java/org/apache/servicemix/common/osgi/EndpointTracker.java
          Sending servicemix-common/src/main/java/org/apache/servicemix/common/wsdl1/AbstractWsdl1Deployer.java
          Sending servicemix-common/src/main/java/org/apache/servicemix/common/xbean/XBeanServiceUnit.java
          Sending servicemix-common/src/test/java/org/apache/servicemix/common/TransactionsTest.java
          Sending servicemix-common/src/test/java/org/apache/servicemix/common/xbean/XBeanEndpoint.java
          Sending servicemix-soap/src/main/java/org/apache/servicemix/soap/SoapEndpoint.java
          Adding servicemix-soap/src/main/java/org/apache/servicemix/soap/SoapExchangeProcessor.java
          Transmitting file data .........................
          Committed revision 695836.
          Sending src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java
          Sending src/test/java/org/apache/servicemix/cxfbc/provider/CxfBCSEProviderSystemTest.java
          Sending src/test/resources/org/apache/servicemix/cxfbc/xbean.xml
          Sending src/test/resources/org/apache/servicemix/cxfbc/xbean_without_jbi_wrapper.xml
          Transmitting file data ....
          Committed revision 695837.
          Sending src/main/java/org/apache/servicemix/file/FileComponent.java
          Transmitting file data .
          Committed revision 695838.
          Sending src/main/java/org/apache/servicemix/ftp/FtpComponent.java
          Transmitting file data .
          Committed revision 695839.
          Sending src/main/java/org/apache/servicemix/http/HttpComponent.java
          Sending src/main/java/org/apache/servicemix/http/HttpEndpoint.java
          Sending src/main/java/org/apache/servicemix/http/HttpWsdl1Deployer.java
          Sending src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java
          Sending src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java
          Sending src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java
          Sending src/test/java/org/apache/servicemix/http/HttpAddressingTest.java
          Sending src/test/java/org/apache/servicemix/http/HttpConsumerTest.java
          Sending src/test/java/org/apache/servicemix/http/HttpProviderTest.java
          Sending src/test/java/org/apache/servicemix/http/HttpXBeanDeployerTest.java
          Sending src/test/java/org/apache/servicemix/http/ProviderEndpointTest.java
          Transmitting file data ...........
          Committed revision 695841.
          Sending src/main/java/org/apache/servicemix/jms/AbstractJmsProcessor.java
          Sending src/main/java/org/apache/servicemix/jms/JmsComponent.java
          Sending src/main/java/org/apache/servicemix/jms/JmsEndpoint.java
          Sending src/main/java/org/apache/servicemix/jms/JmsWsdl1Deployer.java
          Sending src/main/java/org/apache/servicemix/jms/endpoints/AbstractConsumerEndpoint.java
          Sending src/main/java/org/apache/servicemix/jms/endpoints/JmsConsumerEndpoint.java
          Sending src/main/java/org/apache/servicemix/jms/endpoints/JmsProviderEndpoint.java
          Sending src/main/java/org/apache/servicemix/jms/multiplexing/MultiplexingConsumerProcessor.java
          Sending src/main/java/org/apache/servicemix/jms/multiplexing/MultiplexingProviderProcessor.java
          Sending src/main/java/org/apache/servicemix/jms/standard/StandardConsumerProcessor.java
          Sending src/main/java/org/apache/servicemix/jms/standard/StandardProviderProcessor.java
          Sending src/test/java/org/apache/servicemix/jms/JMSComponentTest.java
          Sending src/test/java/org/apache/servicemix/jms/JmsSpringTest.java
          Sending src/test/java/org/apache/servicemix/jms/JmsXBeanDeployerTest.java
          Transmitting file data ..............
          Committed revision 695842.
          Sending pom.xml
          Sending src/main/java/org/apache/servicemix/truezip/TrueZipComponent.java
          Transmitting file data ..
          Committed revision 695843.
          Sending src/main/java/org/apache/servicemix/xmpp/XMPPComponent.java
          Transmitting file data .
          Committed revision 695845.
          Sending src/main/java/org/apache/servicemix/bean/BeanComponent.java
          Sending src/test/java/org/apache/servicemix/bean/ConsumerBeanTest.java
          Sending src/test/java/org/apache/servicemix/bean/ConsumerListenerTest.java
          Sending src/test/java/org/apache/servicemix/bean/beans/ConsumerListener.java
          Sending src/test/resources/log4j.properties
          Transmitting file data .....
          Committed revision 695846.
          Sending src/main/java/org/apache/servicemix/camel/CamelJbiComponent.java
          Transmitting file data .
          Committed revision 695847.
          Sending src/test/java/org/apache/servicemix/cxfse/GreeterImpl.java
          Sending src/test/resources/log4j.properties
          Transmitting file data ..
          Committed revision 695848.
          Sending src/main/java/org/apache/servicemix/drools/DroolsEndpoint.java
          Transmitting file data .
          Committed revision 695849.
          Sending src/test/java/org/apache/servicemix/eip/DeploymentTest.java
          Transmitting file data .
          Committed revision 695850.
          Sending src/test/java/org/apache/servicemix/jsr181/Jsr181ComplexPojoTest.java
          Sending src/test/java/org/apache/servicemix/jsr181/Jsr181ComponentTest.java
          Sending src/test/java/org/apache/servicemix/jsr181/Jsr181SpringProxyTest.java
          Sending src/test/java/test/TestEndpoint.java
          Transmitting file data ....
          Committed revision 695851.
          Sending src/test/java/org/apache/servicemix/osworkflow/OSWorkflowFailureTest.java
          Sending src/test/java/org/apache/servicemix/osworkflow/OSWorkflowSucessTest.java
          Transmitting file data ..
          Committed revision 695852.
          Sending src/test/java/org/apache/servicemix/saxon/SaxonComponentTest.java
          Transmitting file data .
          Committed revision 695853.
          Sending src/main/java/org/apache/servicemix/wsn/client/AbstractWSAClient.java
          Sending src/main/java/org/apache/servicemix/wsn/component/WSNComponent.java
          Sending src/main/java/org/apache/servicemix/wsn/component/WSNDeployableEndpoint.java
          Sending src/main/java/org/apache/servicemix/wsn/component/WSNEndpoint.java
          Sending src/main/java/org/apache/servicemix/wsn/component/WSNServiceUnit.java
          Sending src/main/java/org/apache/servicemix/wsn/spring/PublisherComponent.java
          Sending src/test/java/org/apache/servicemix/wsn/component/WSNComponentTest.java
          Sending src/test/java/org/apache/servicemix/wsn/component/WSNSpringComponentTest.java
          Transmitting file data ........
          Committed revision 695854.

          Show
          Guillaume Nodet added a comment - Note that the following commits do not enable waiting for all exchanges to be processed when deactivating the endpoint Sending servicemix-common/pom.xml Sending servicemix-common/src/main/java/org/apache/servicemix/common/AbstractDeployer.java Sending servicemix-common/src/main/java/org/apache/servicemix/common/AsyncBaseLifeCycle.java Sending servicemix-common/src/main/java/org/apache/servicemix/common/BaseComponent.java Sending servicemix-common/src/main/java/org/apache/servicemix/common/BaseServiceUnitManager.java Sending servicemix-common/src/main/java/org/apache/servicemix/common/DefaultBootstrap.java Sending servicemix-common/src/main/java/org/apache/servicemix/common/DefaultComponent.java Adding servicemix-common/src/main/java/org/apache/servicemix/common/DefaultServiceUnit.java Sending servicemix-common/src/main/java/org/apache/servicemix/common/Endpoint.java Sending servicemix-common/src/main/java/org/apache/servicemix/common/EndpointDeliveryChannel.java Sending servicemix-common/src/main/java/org/apache/servicemix/common/ExchangeProcessor.java Sending servicemix-common/src/main/java/org/apache/servicemix/common/Registry.java Sending servicemix-common/src/main/java/org/apache/servicemix/common/ServiceMixComponent.java Sending servicemix-common/src/main/java/org/apache/servicemix/common/ServiceUnit.java Adding servicemix-common/src/main/java/org/apache/servicemix/common/endpoints/AbstractEndpoint.java Sending servicemix-common/src/main/java/org/apache/servicemix/common/endpoints/ConsumerEndpoint.java Sending servicemix-common/src/main/java/org/apache/servicemix/common/endpoints/ProviderEndpoint.java Sending servicemix-common/src/main/java/org/apache/servicemix/common/endpoints/SimpleEndpoint.java Sending servicemix-common/src/main/java/org/apache/servicemix/common/osgi/EndpointTracker.java Sending servicemix-common/src/main/java/org/apache/servicemix/common/wsdl1/AbstractWsdl1Deployer.java Sending servicemix-common/src/main/java/org/apache/servicemix/common/xbean/XBeanServiceUnit.java Sending servicemix-common/src/test/java/org/apache/servicemix/common/TransactionsTest.java Sending servicemix-common/src/test/java/org/apache/servicemix/common/xbean/XBeanEndpoint.java Sending servicemix-soap/src/main/java/org/apache/servicemix/soap/SoapEndpoint.java Adding servicemix-soap/src/main/java/org/apache/servicemix/soap/SoapExchangeProcessor.java Transmitting file data ......................... Committed revision 695836. Sending src/main/java/org/apache/servicemix/cxfbc/CxfBcConsumer.java Sending src/test/java/org/apache/servicemix/cxfbc/provider/CxfBCSEProviderSystemTest.java Sending src/test/resources/org/apache/servicemix/cxfbc/xbean.xml Sending src/test/resources/org/apache/servicemix/cxfbc/xbean_without_jbi_wrapper.xml Transmitting file data .... Committed revision 695837. Sending src/main/java/org/apache/servicemix/file/FileComponent.java Transmitting file data . Committed revision 695838. Sending src/main/java/org/apache/servicemix/ftp/FtpComponent.java Transmitting file data . Committed revision 695839. Sending src/main/java/org/apache/servicemix/http/HttpComponent.java Sending src/main/java/org/apache/servicemix/http/HttpEndpoint.java Sending src/main/java/org/apache/servicemix/http/HttpWsdl1Deployer.java Sending src/main/java/org/apache/servicemix/http/endpoints/HttpConsumerEndpoint.java Sending src/main/java/org/apache/servicemix/http/processors/ConsumerProcessor.java Sending src/main/java/org/apache/servicemix/http/processors/ProviderProcessor.java Sending src/test/java/org/apache/servicemix/http/HttpAddressingTest.java Sending src/test/java/org/apache/servicemix/http/HttpConsumerTest.java Sending src/test/java/org/apache/servicemix/http/HttpProviderTest.java Sending src/test/java/org/apache/servicemix/http/HttpXBeanDeployerTest.java Sending src/test/java/org/apache/servicemix/http/ProviderEndpointTest.java Transmitting file data ........... Committed revision 695841. Sending src/main/java/org/apache/servicemix/jms/AbstractJmsProcessor.java Sending src/main/java/org/apache/servicemix/jms/JmsComponent.java Sending src/main/java/org/apache/servicemix/jms/JmsEndpoint.java Sending src/main/java/org/apache/servicemix/jms/JmsWsdl1Deployer.java Sending src/main/java/org/apache/servicemix/jms/endpoints/AbstractConsumerEndpoint.java Sending src/main/java/org/apache/servicemix/jms/endpoints/JmsConsumerEndpoint.java Sending src/main/java/org/apache/servicemix/jms/endpoints/JmsProviderEndpoint.java Sending src/main/java/org/apache/servicemix/jms/multiplexing/MultiplexingConsumerProcessor.java Sending src/main/java/org/apache/servicemix/jms/multiplexing/MultiplexingProviderProcessor.java Sending src/main/java/org/apache/servicemix/jms/standard/StandardConsumerProcessor.java Sending src/main/java/org/apache/servicemix/jms/standard/StandardProviderProcessor.java Sending src/test/java/org/apache/servicemix/jms/JMSComponentTest.java Sending src/test/java/org/apache/servicemix/jms/JmsSpringTest.java Sending src/test/java/org/apache/servicemix/jms/JmsXBeanDeployerTest.java Transmitting file data .............. Committed revision 695842. Sending pom.xml Sending src/main/java/org/apache/servicemix/truezip/TrueZipComponent.java Transmitting file data .. Committed revision 695843. Sending src/main/java/org/apache/servicemix/xmpp/XMPPComponent.java Transmitting file data . Committed revision 695845. Sending src/main/java/org/apache/servicemix/bean/BeanComponent.java Sending src/test/java/org/apache/servicemix/bean/ConsumerBeanTest.java Sending src/test/java/org/apache/servicemix/bean/ConsumerListenerTest.java Sending src/test/java/org/apache/servicemix/bean/beans/ConsumerListener.java Sending src/test/resources/log4j.properties Transmitting file data ..... Committed revision 695846. Sending src/main/java/org/apache/servicemix/camel/CamelJbiComponent.java Transmitting file data . Committed revision 695847. Sending src/test/java/org/apache/servicemix/cxfse/GreeterImpl.java Sending src/test/resources/log4j.properties Transmitting file data .. Committed revision 695848. Sending src/main/java/org/apache/servicemix/drools/DroolsEndpoint.java Transmitting file data . Committed revision 695849. Sending src/test/java/org/apache/servicemix/eip/DeploymentTest.java Transmitting file data . Committed revision 695850. Sending src/test/java/org/apache/servicemix/jsr181/Jsr181ComplexPojoTest.java Sending src/test/java/org/apache/servicemix/jsr181/Jsr181ComponentTest.java Sending src/test/java/org/apache/servicemix/jsr181/Jsr181SpringProxyTest.java Sending src/test/java/test/TestEndpoint.java Transmitting file data .... Committed revision 695851. Sending src/test/java/org/apache/servicemix/osworkflow/OSWorkflowFailureTest.java Sending src/test/java/org/apache/servicemix/osworkflow/OSWorkflowSucessTest.java Transmitting file data .. Committed revision 695852. Sending src/test/java/org/apache/servicemix/saxon/SaxonComponentTest.java Transmitting file data . Committed revision 695853. Sending src/main/java/org/apache/servicemix/wsn/client/AbstractWSAClient.java Sending src/main/java/org/apache/servicemix/wsn/component/WSNComponent.java Sending src/main/java/org/apache/servicemix/wsn/component/WSNDeployableEndpoint.java Sending src/main/java/org/apache/servicemix/wsn/component/WSNEndpoint.java Sending src/main/java/org/apache/servicemix/wsn/component/WSNServiceUnit.java Sending src/main/java/org/apache/servicemix/wsn/spring/PublisherComponent.java Sending src/test/java/org/apache/servicemix/wsn/component/WSNComponentTest.java Sending src/test/java/org/apache/servicemix/wsn/component/WSNSpringComponentTest.java Transmitting file data ........ Committed revision 695854.
          Hide
          Guillaume Nodet added a comment -

          Waiting for the endpoints to not have pending exchanges will only work if this is done globally for the SAs, else some endpoints needed to process some pending exchanges may be unregistered too soon.
          Also, we need a timeout on such a wait.

          Show
          Guillaume Nodet added a comment - Waiting for the endpoints to not have pending exchanges will only work if this is done globally for the SAs, else some endpoints needed to process some pending exchanges may be unregistered too soon. Also, we need a timeout on such a wait.
          Hide
          Guillaume Nodet added a comment -

          I'm doing very good progress on that one.
          This seems to work nicely for JMS, but other kind of consumers (quartz, http or pollers) may need a better shut down processing.
          I think that they should keep track of the number of consumer exchanges sent and when shutting down, wait for all these exchanges to be fully processed (i.e. no pending messages at all).
          That's what is happening with the <jms:consumer /> endpoint because the shut down of the jms listener container waits for all listeners to be fully executed.
          I'm thinking we could do that in the component itself, has it should be aware of all exchanges received / sent by endpoints, so that endpoints would not have to take care about that.

          Show
          Guillaume Nodet added a comment - I'm doing very good progress on that one. This seems to work nicely for JMS, but other kind of consumers (quartz, http or pollers) may need a better shut down processing. I think that they should keep track of the number of consumer exchanges sent and when shutting down, wait for all these exchanges to be fully processed (i.e. no pending messages at all). That's what is happening with the <jms:consumer /> endpoint because the shut down of the jms listener container waits for all listeners to be fully executed. I'm thinking we could do that in the component itself, has it should be aware of all exchanges received / sent by endpoints, so that endpoints would not have to take care about that.
          Hide
          Guillaume Nodet added a comment -

          Instead of renaming start / stop methods, which usually do already what we want, we need to leverage the activate / deactivate methods, changing those so that they don't automatically call start / stop.
          In addition, for servicemix-http, the jetty contexts have a shutdown state which can be used, but it seems to bypass any processing thus the client won't receive anything. It may be better to return a 503 error instead.

          Show
          Guillaume Nodet added a comment - Instead of renaming start / stop methods, which usually do already what we want, we need to leverage the activate / deactivate methods, changing those so that they don't automatically call start / stop. In addition, for servicemix-http, the jetty contexts have a shutdown state which can be used, but it seems to bypass any processing thus the client won't receive anything. It may be better to return a 503 error instead.
          Hide
          Guillaume Nodet added a comment -

          Yes, I think so. The startup / shutdown of the container should take care of transitioning all the SA / SU to the same stage before goind to another stage.
          I.e. when starting the container, it should first init all SUs (i.e. register all endpoints, but no endpoints should start sending exchanges), then start them all.
          When shutting down, it would stop all SUs, stopping servicing new requests from the ouside world, while enabling pending requests to be processed.

          Show
          Guillaume Nodet added a comment - Yes, I think so. The startup / shutdown of the container should take care of transitioning all the SA / SU to the same stage before goind to another stage. I.e. when starting the container, it should first init all SUs (i.e. register all endpoints, but no endpoints should start sending exchanges), then start them all. When shutting down, it would stop all SUs, stopping servicing new requests from the ouside world, while enabling pending requests to be processed.
          Hide
          Ron Gavlin added a comment -

          Does this issue contribute towards fixing https://issues.apache.org/activemq/browse/SM-1554 in addition to the other related issues created recently?

          Show
          Ron Gavlin added a comment - Does this issue contribute towards fixing https://issues.apache.org/activemq/browse/SM-1554 in addition to the other related issues created recently?
          Hide
          Guillaume Nodet added a comment -

          Yes, of couse. I may have missed some other consumer endpoints (the WS-Notification SE might need some changes too).
          But those enhancements in the endpoints can be done in parallel or deferred as will (though a one shot thing would be nice)

          Show
          Guillaume Nodet added a comment - Yes, of couse. I may have missed some other consumer endpoints (the WS-Notification SE might need some changes too). But those enhancements in the endpoints can be done in parallel or deferred as will (though a one shot thing would be nice)
          Hide
          Ron Gavlin added a comment -

          Does the cxf-bc consumer require this change as well?

          Show
          Ron Gavlin added a comment - Does the cxf-bc consumer require this change as well?

            People

            • Assignee:
              Guillaume Nodet
              Reporter:
              Guillaume Nodet
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development