Tomer Arbel opened SPR-15633 and commented
Spring's remote invocation infrastructure allows adding serializable attributes on a remote request in org.springframework.remoting.support.RemoteInvocation
.
As the javadoc explains:
This is very useful for adding additional invocation data without having to subclass
RemoteInvocation
. (RemoteInvocation#addAttribute(...))
While this is supported on the remote request side, the response side does not support that.
Meaning, if there is a need to add data to the remote response, org.springframework.remoting.support.RemoteInvocationResult
must be subclassed to contain the extra data.
I suggest adding attributes support to org.springframework.remoting.support.RemoteInvocationResult
to match the capabilities of org.springframework.remoting.support.RemoteInvocation
.
1 votes, 2 watchers
Comment From: spring-projects-issues
Tomer Arbel commented
An example for a use case:
1. App1 on ServerA calls a cluster of App2 servers.
2. An implementation of org.springframework.remoting.httpinvoker.HttpInvokerClientInterceptor.executeRequest(RemoteInvocation)
adds an attribute requestingServer=ServerA
.
3. App2 cluster routes the request to App2 on ServerE.
4. An implementation of com.plimus.platform.remoting.RemoteInfoHttpInvokerServiceExporter.invoke(RemoteInvocation, Object)
retrieves the requestingServer
attribute and writes it to log.
(All above is currently supported, all below requires this improvement)
5. An implementation of org.springframework.remoting.support.RemoteInvocationBasedExporter.invokeAndCreateResult(RemoteInvocation, Object)
(on ServerE) adds a response attribute respondingServer=ServerE
.
6. ServerA receives the response from ServerE, retrieves the responsingServer
attribute and writes it to log.
Comment From: rstoyanchev
Closing since remoting support has been dropped for 6.0 in #27422.