Skip to content

Commit 7671abe

Browse files
committed
Fix readme
1 parent cd2d12f commit 7671abe

File tree

1 file changed

+4
-32
lines changed

1 file changed

+4
-32
lines changed

README.md

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,7 +1625,7 @@ class UnifiedPlugin(ClientPlugin, WorkerPlugin):
16251625
def configure_client(self, config: ClientConfig) -> ClientConfig:
16261626
# Client-side customization
16271627
config["data_converter"] = pydantic_data_converter
1628-
return super().configure_client(config)
1628+
return self.next_client_plugin.configure_client(config)
16291629

16301630
async def connect_service_client(
16311631
self, config: temporalio.service.ConnectConfig
@@ -1636,11 +1636,11 @@ class UnifiedPlugin(ClientPlugin, WorkerPlugin):
16361636

16371637
def configure_worker(self, config: WorkerConfig) -> WorkerConfig:
16381638
# Worker-side customization
1639-
return super().configure_worker(config)
1639+
return self.next_worker_plugin.configure_worker(config)
16401640

16411641
async def run_worker(self, worker: Worker) -> None:
16421642
print("Starting unified worker")
1643-
await super().run_worker(worker)
1643+
await self.next_worker_plugin.run_worker(worker)
16441644

16451645
def configure_replayer(self, config: ReplayerConfig) -> ReplayerConfig:
16461646
config["data_converter"] = pydantic_data_converter
@@ -1668,40 +1668,12 @@ worker = Worker(
16681668
)
16691669
```
16701670

1671-
1672-
1673-
```python
1674-
class ReplayPlugin(temporalio.client.Plugin, temporalio.worker.Plugin):
1675-
def configure_client(self, config: ClientConfig) -> ClientConfig:
1676-
config["data_converter"] = pydantic_data_converter
1677-
return super().configure_client(config)
1678-
1679-
def configure_worker(self, config: WorkerConfig) -> WorkerConfig:
1680-
config["workflows"] = list(config.get("workflows") or []) + [HelloWorkflow]
1681-
return super().configure_worker(config)
1682-
1683-
def configure_replayer(self, config: ReplayerConfig) -> ReplayerConfig:
1684-
config["data_converter"] = pydantic_data_converter
1685-
config["workflows"] = list(config.get("workflows") or []) + [HelloWorkflow]
1686-
return config
1687-
1688-
@asynccontextmanager
1689-
async def workflow_replay(
1690-
self,
1691-
replayer: Replayer,
1692-
histories: AsyncIterator[temporalio.client.WorkflowHistory],
1693-
) -> AsyncIterator[AsyncIterator[WorkflowReplayResult]]:
1694-
with set_some_context():
1695-
async with super().workflow_replay(replayer, histories) as results:
1696-
yield results
1697-
```
1698-
16991671
**Important Notes:**
17001672

17011673
- Plugins are executed in reverse order (last plugin wraps the first), forming a chain of responsibility
17021674
- Client plugins that also implement worker plugin interfaces are automatically propagated to workers
17031675
- Avoid providing the same plugin to both client and worker to prevent double execution
1704-
- Plugin methods should call `super()` to maintain the plugin chain
1676+
- Plugin methods should call the plugin provided during initialization to maintain the plugin chain
17051677
- Each plugin's `name()` method returns a unique identifier for debugging purposes
17061678

17071679

0 commit comments

Comments
 (0)