Add local execution mode for queue-based RPC without TCP #698
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new execution mode where RPC requests are executed locally on the worker node that dequeues work from the
IPendingRequestQueue, rather than being proxied over TCP to a remote service. This allows for executing RPCs by use of a distributedPendingRequestQueueonly.Motivation
We are sometimes in the situation in which we need work to picked up by specific nodes e.g. a client is connected to only one node and we need that node to process the work.
With this change and a distributed queue (e.g. the Redis one), it would be possible to setup something like:
halibutRunTime.PollLocalAsync(new Uri("local://bob"), workerCts.Token)and so would begin to processes messages sent to "local://bob".var echo = client.CreateAsyncClient<IEchoService, IAsyncClientEchoService>(new ("local://test-worker");Changes
Core Implementation
HalibutRuntime.PollLocalAsync()- New method that polls alocal://queue and executes RPCs locallylocal://URI scheme support - Added to routing logic inSendOutgoingRequestAsync()GetQueue()and execute requests usingServiceInvokerDocumentation
/docs/LocalExecutionMode.mdTesting
LocalExecutionModeFixturewith test demonstrating local executionPendingRequestQueueFactoryso client and worker share the same queueUsage
Benefits
local://queuepoll://andhttps://endpoints work unchangedArchitecture
The implementation bypasses the entire
PollingClientandMessageExchangeProtocolmachinery:Current TCP Polling:
New Local Execution:
No TCP connection, no protocol messages, no serialization overhead.
🤖 Generated with Claude Code