class Plugin(abc.ABC): (source)
Known subclasses: temporalio.contrib.openai_agents.OpenAIAgentsPlugin
, temporalio.client._RootPlugin
Base class for client plugins that can intercept and modify client behavior.
Plugins allow customization of client creation and service connection processes through a chain of responsibility pattern. Each plugin can modify the client configuration or intercept service client connections.
If the plugin is also a temporalio.worker.Plugin, it will additionally be propagated as a worker plugin. You should likley not also provide it to the worker as that will result in the plugin being applied twice.
Method | configure |
Hook called when creating a client to allow modification of configuration. |
Async Method | connect |
Hook called when connecting to the Temporal service. |
Method | init |
Initialize this plugin in the plugin chain. |
Method | name |
Get the name of this plugin. Can be overridden if desired to provide a more appropriate name. |
Hook called when creating a client to allow modification of configuration.
This method is called during client creation and allows plugins to modify the client configuration before the client is fully initialized. Plugins can add interceptors, modify connection parameters, or change other settings.
Parameters | |
config:ClientConfig | The client configuration dictionary to potentially modify. |
Returns | |
ClientConfig | The modified client configuration. |
async def connect_service_client(self, config:
temporalio.service.ConnectConfig
) -> temporalio.service.ServiceClient
:
(source)
¶
Hook called when connecting to the Temporal service.
This method is called during service client connection and allows plugins to intercept or modify the connection process. Plugins can modify connection parameters, add authentication, or provide custom connection logic.
Parameters | |
config:temporalio.service.ConnectConfig | The service connection configuration. |
Returns | |
temporalio.service.ServiceClient | The connected service client. |
Initialize this plugin in the plugin chain.
This method sets up the chain of responsibility pattern by providing a reference
to the next plugin in the chain. It is called during client creation to build
the plugin chain. Note, this may be called twice in the case of connect
.
Implementations should store this reference and call the corresponding method
of the next plugin on method calls.
Parameters | |
next:Plugin | The next plugin in the chain to delegate to. |