feat: Wire in-service RPC core for ctx.rpc.call#156
Merged
Conversation
Add a real implementation behind the placeholder `RpcCaller` introduced in the previous commit. Each `RpcService` now stands up a per-instance reply queue (`rpc.listener-<service-uuid>`), a publish channel, and a `DashMap<correlation_id, oneshot::Sender<PayloadResult>>` correlation map that the reply consumer drains. `RpcCaller::call(service, method, payload)` is `pub async`. Per delivery, the consumer derives a caller stamped with the inbound delivery's headers via `with_parent_headers`, so `nameko.call_id_stack` propagates from the parent. `nameko.AMQP_URI` is always stamped; the stack is seeded with the service identifier when the parent had none. The new `examples/src/proxy_service.rs` demonstrates a service that forwards `proxy.hello` to `video.hello` from inside its handler. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Builds on #155 (the async handler /
RpcContextrefactor) to makectx.rpc.call(...)actually work.girolle/src/rpc_core.rs—RpcCallerCoreowns a per-service reply queue (rpc.listener-<service-uuid>), a publish channel, and aDashMap<correlation_id, oneshot::Sender<PayloadResult>>correlation map.new()declares the queue, starts a delegate that drains correlations into the map, and returnsArc<Self>.RpcCallernow holdsOption<Arc<RpcCallerCore>>plus the parent delivery'sFieldTable.pub async fn call(service, method, payload) -> GirolleResult<Value>is live. Per-delivery, the consumer derives a caller viawith_parent_headers(inbound_headers)sonameko.call_id_stackpropagates from the parent.nameko.AMQP_URIis always stamped; the stack is seeded with the service identifier when the parent had none.RpcServicestartup callsRpcCallerCore::new(&conn, conf, id)once and stores the resulting caller inSharedData.dashmap = 6.1and theproxy_serviceexample forwardingproxy.hello→video.hellofrom inside its handler.Known limitations (deferred)
call_id_stackis propagated as-is from the parent — Python Nameko also stamps the parent service's outbound call entry on the way out. Cosmetic; the chain is still continued correctly by the target.EventDispatcherstill inert — that's the next PR.Test plan
cargo build --workspacecargo build --examples(incl. newproxy_service)cargo test --workspace --lib(14 passed)cargo test --workspace --doc(30 + 1 passed)cargo clippy --workspace --all-targets🤖 Generated with Claude Code