Alessio Soldano wrote:
I'm thinking of an alternative solution; it should be possible to use the Exchange associated to a given message as the mean for shipping the endpoint instance to the invoker. I'm thinking of using a custom ServletDestination for adding the endpoint to the exchange after it's been created. I'll try this later today or early tomorrow morning, then I'll most probably need you to help again with testing the solution.
Using a custom ServletDestion actually also requires redefining the ServletDefinitionFactory, hence it's not that a brilliant solution.
Another (most probably) better idea I'm currently evaluating is installing a custom interceptor early in the server incoming chain (the MAPAggregator runs at PRE_LOGICAL phase, so any time before that should be fine). That interceptor would populate the the current Exchange with the Endpoint, which we should be able to safely retrieve using the thread local at that point (no new thread created or access to thread pool yet).