Question

What is the "canonical" way to access the MessageContext from a PayloadEndpoint?

We are using PayloadEndpoint and AbstractMarshallingPayloadEndpoint which do not expose the MessageContext to their invoke / invokeinternal methods, but will now need to access the HTTP request parameters.

Was it helpful?

Solution

Easiest way I can think of: create a 'wrapper' endpoint which implements MessageEndpoint. Then you can extract your request parameters and pass them down to your actual endpoint.

You could store the request variables in a ThreadLocal so the original endpoint can access them.

OTHER TIPS

Someone on the Spring forum suggested to use the TransportContext to access the HTTP request parameters. This helps to solve our particular problem, but does not answer the original question how to get the MessageContext.

Another Idea would be to introduce an EndpointInterceptor and use a ThreadLocal. But I was hoping there is a way that feels less like hack.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top