26 lines
566 B
Markdown
26 lines
566 B
Markdown
# chongming-request
|
||
|
||
Worker 直连客户端,用于从服务端调用 Zenoh Worker 的 RPC 方法。
|
||
|
||
## 功能
|
||
|
||
- 自动发现存活 Worker(基于 Zenoh liveliness)
|
||
- 随机负载均衡
|
||
- 超时重试
|
||
- 支持同步/异步调用
|
||
|
||
## 使用
|
||
|
||
```python
|
||
from chongming_request import Client
|
||
|
||
async with Client(session=zenoh_session) as client:
|
||
result = await client.call(
|
||
worker_type="example",
|
||
subject="example.add",
|
||
payload={"a": 1, "b": 2},
|
||
method="GET"
|
||
)
|
||
print(result) # {"result": 3, "operation": "add", ...}
|
||
```
|