DO multi-worker example?

Hi, I'm looking for a multi-worker example where say worker_a calls RPC methods running in a DO whose class implementation lives in worker_b. The example in the rpc docs shows a services binding to a worker (by name).
services = [
{ binding = "COUNTER_SERVICE", service = "counter-service" }
]
services = [
{ binding = "COUNTER_SERVICE", service = "counter-service" }
]
Is there an equivalent RPC binding for a DO class using the class_name?
4 Replies
Jürgen Leschner
Jürgen LeschnerOP3mo ago
Another way to ask the question maybe: How do I avoid maintaining DO class (callee) code and worker (caller) code in a single worker? or maybe rephrasing: Does all DO access have to go through the same worker implementation as the DO class? (sorry for the messy thread 😊 )
kian
kian3mo ago
Sounds like you want the script_name part of the DO binding? https://developers.cloudflare.com/workers/wrangler/configuration/#durable-objects
Jürgen Leschner
Jürgen LeschnerOP3mo ago
Thank so much @kian - that's the part i was missing 🙏 ... I was looking here and was distracted by "environments" instead of focusing on the worker name.
Cloudflare Docs
Get started | Cloudflare Durable Objects docs
This guide will instruct you through:
Jürgen Leschner
Jürgen LeschnerOP3mo ago
GitHub
[DO] Clarify script_name in durable_objects.bindings by jldec · Pul...
Summary Consistent wording in the DO Get Started page to clarify the script_name field of durable_objects.bindings. Link to wrangler.toml docs for more details. Context: I got a bit stuck configu...
Want results from more Discord servers?
Add your server