According to the JBI specification (see 7.2.1.2 Endpoint Activation and Deactivation), the contract of the activateEndpoint operation is that an endpoint should be activated ONLY if the component is ready to answer requests.
For SUs, currently, the endpoint is activated on deploy and not after init, which is the moment Petals components should be ready to answer requests for SUs.
For native endpoints, they are activated during init, which is the moment components should be ready to answer native requests.
We should thus change the moment we activate the endpoints: at the end of the init of their SU.
Conversely, we should deactivate the endpoints before the component shutdown their SU.
We should NOT change the moment we activate the native endpoints, because this is correct (activated when the component is not shutdown).
This means also that we should fix the components that relied on the assumption that their endpoints (SU and native) were activated before init and after shutdown.
And we should fix the components that are not ready to serve the messages (for SU and native endpoints) after init and before shutdown.
The integration lifecycle test should be updated, and the hack handling exchange for non-started SUs in the Container Router can be safely removed.
Updated the description to match new discussions: endpoints are activated just after init is executed and deactivated just before shutdown is executed.