Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPC Hooks #332

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

RPC Hooks #332

wants to merge 5 commits into from

Conversation

mbonneau
Copy link
Member

This change creates a Thruway-specific feature that allows for the hooking of RPCs.

A client can register an RPC that will receive calls for an already existing RPC. The client can then choose to service the call itself or it can call the original hooked RPC (either using it's own session context or the original session's context).

The use case for this feature are similar to hooking in any other environment. (debugging, extending functionality without changing the original RPC, etc.)

Usage:

Hook an existing RPC by registering a new RPC with the same name and the option: 'x_thruway_hook' => true. This registration will then receive all calls to that RPC.

These INVOCATIONs can be handled as a normal RPC if desired. The existing registration will not receive the INVOCATIONs.

The hooked registration can also call the underlying RPC by making a call with the option: ['x_thruway_call_hooked' => (object)[ 'registration_id' => $hookRegistrationId ]] and can call the underlying RPC with the session context of the caller using:

(object)[
                'x_thruway_call_hooked' => (object)[
                    'registration_id' => $hookRegistrationId,
                    'with_caller_from' => $origInvocationMessage->getRequestId()
                ]
            ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant