Implement planned topic: 0035-dns-resolver-config (#219)

* Implement planned topic: 0035-dns-resolver-config

Add DNS Resolver Configuration section to references/python/advanced-features.md
documenting temporalio.service.DnsLoadBalancingConfig: the resolution_interval_millis
field, the default classvar, the Client.connect / CloudOperationsClient.connect
kwargs, and the silent mutual-exclusion with HttpConnectProxyConfig. Anchored to
sdk-python v1.27.2 source (the official docs site does not yet cover this class).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* Finalize draft for 0035-dns-resolver-config

* Apply suggestions from code review

Co-authored-by: Donald Pinckney <donald_pinckney@icloud.com>

---------

Co-authored-by: skill-sync[bot] <skill-sync[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: Donald Pinckney <donald.pinckney@temporal.io>
Co-authored-by: Donald Pinckney <donald_pinckney@icloud.com>
This commit is contained in:
skill-temporal-developer-updater[bot]
2026-05-29 17:34:40 -04:00
committed by GitHub
parent d52c54af05
commit 351eadaf54
+27
View File
@@ -114,6 +114,33 @@ worker = Worker(
)
```
## DNS Resolver Configuration
`DnsLoadBalancingConfig` makes Core periodically re-resolve the client's target host and round-robin requests across the resolved addresses . Use it when `target_host` resolves to multiple A/AAAA records (e.g., a load-balanced gRPC frontend, multi-address private endpoints) and you want the client to spread RPCs across them.
### Configuration
```python
from temporalio.client import Client
from temporalio.service import DnsLoadBalancingConfig
client = await Client.connect(
"frontend.example.internal:7233",
dns_load_balancing_config=DnsLoadBalancingConfig(
resolution_interval_millis=5000, # re-resolve every 5 seconds
),
)
```
- The only field is `resolution_interval_millis: int = 30000` — how often to re-resolve DNS, in milliseconds.
- `DnsLoadBalancingConfig.default` is a pre-built instance with the default 30-second interval.
- `dns_load_balancing_config` defaults to 30 seconds if you don't pass anything explicitly.
- Pass `dns_load_balancing_config=None` to disable DNS load balancing entirely.
### Mutual exclusion with HTTP CONNECT proxy
DNS load balancing and `HttpConnectProxyConfig` cannot be used together. When `http_connect_proxy_config` is set on the same client, DNS load balancing is **silently disabled** — there is no error and no precedence flag. If you need both, you cannot have both; choose the one your network requires.
## Workflow Init Decorator
You should always put state initialization logic in the `__init__` of your workflow class, so that it happens before signals/updates arrive.