GemTalk / RemoteServiceReplication

MIT License
0 stars 4 forks source link

Would like RsrService hooks to execute code before and after message send #116

Open ericwinger opened 3 years ago

ericwinger commented 3 years ago

After a client service sends a message to remoteSelf, the server invokes that method and returns the result object. However, there are times when additional code needs to run after the method has completed to prepare the result object for transport back to the client, cleanup state, or for tracking. That work might be necessary after a variety of different messages are sent.

Example - The developer might like to know how many times a remote service is invoked regardless of which message is sent to the service.

It would be helpful to have a preMessageInvocation and postMessageInvocation hook in RsrService to do things like this.

kurtkilpela commented 1 week ago

I'm hesitant to do this. If an error happens in either the pre or post message, what should happen? Should RSR abort and report on that error? In the post case, should it report on that error even though it successfully got a return value from the original message send?

I'm going to close this for now unless a compelling case comes up and we have reasonable semantics.

ericwinger commented 1 week ago

The possibility of an error shouldn't preclude the addition of custom hooks. I'd like to leave this open unless there is a compelling technical reason not to do it. It doesn't have to be done anytime soon unless a specific need arises.