TemporalPluginInterface
extends
ConnectionPluginInterface, ClientPluginInterface, ScheduleClientPluginInterface, WorkerPluginInterface
in
Combined plugin interface for bundles that configure connection, client, schedule client, and worker.
Implementing this interface is optional — plugins may implement only ConnectionPluginInterface, ClientPluginInterface, ScheduleClientPluginInterface, or WorkerPluginInterface as needed.
Table of Contents
Methods
- configureClient() : void
- Modify client configuration before the client is created.
- configureScheduleClient() : void
- Modify schedule client configuration before the client is created.
- configureServiceClient() : ServiceClientInterface
- Modify the service client before it is used by the client.
- configureWorker() : void
- Modify worker configuration before the worker is created.
- configureWorkerFactory() : void
- Modify worker factory configuration before it is fully initialized.
- getName() : string
- Unique name identifying this plugin (e.g., "my-org.tracing").
- initializeWorker() : void
- Called after a worker is created, allowing plugins to register workflows, activities, and other components on the worker.
- run() : int
- Wraps the worker factory run lifecycle using chain-of-responsibility.
- runWorker() : PromiseInterface
Methods
configureClient()
Modify client configuration before the client is created.
public
configureClient(ClientPluginContext $context, callable(ClientPluginContext): void $next) : void
Called in registration order (first plugin registered = first called).
Parameters
- $context : ClientPluginContext
- $next : callable(ClientPluginContext): void
-
Calls the next plugin or the final hook.
configureScheduleClient()
Modify schedule client configuration before the client is created.
public
configureScheduleClient(ScheduleClientPluginContext $context, callable(ScheduleClientPluginContext): void $next) : void
Called in registration order (first plugin registered = first called).
Parameters
- $context : ScheduleClientPluginContext
- $next : callable(ScheduleClientPluginContext): void
-
Calls the next plugin or the final hook.
configureServiceClient()
Modify the service client before it is used by the client.
public
configureServiceClient(ServiceClientInterface $serviceClient, callable(ServiceClientInterface): void $next) : ServiceClientInterface
Use this hook to configure connection-level settings such as API keys, gRPC metadata, auth tokens, or context options.
Parameters
- $serviceClient : ServiceClientInterface
- $next : callable(ServiceClientInterface): void
-
Calls the next plugin or the final hook.
Return values
ServiceClientInterfaceconfigureWorker()
Modify worker configuration before the worker is created.
public
configureWorker(WorkerPluginContext $context, callable(WorkerPluginContext): void $next) : void
Task queue name is available via WorkerPluginContext::getTaskQueue().
Parameters
- $context : WorkerPluginContext
- $next : callable(WorkerPluginContext): void
-
Calls the next plugin or the final hook.
configureWorkerFactory()
Modify worker factory configuration before it is fully initialized.
public
configureWorkerFactory(WorkerFactoryPluginContext $context, callable(WorkerFactoryPluginContext): void $next) : void
Parameters
- $context : WorkerFactoryPluginContext
- $next : callable(WorkerFactoryPluginContext): void
-
Calls the next plugin or the final hook.
getName()
Unique name identifying this plugin (e.g., "my-org.tracing").
public
getName() : string
Used for deduplication and diagnostics.
Return values
stringinitializeWorker()
Called after a worker is created, allowing plugins to register workflows, activities, and other components on the worker.
public
initializeWorker(WorkerInterface $worker, callable(WorkerInterface): void $next) : void
This method is called in forward (registration) order immediately after the worker is created. This is the appropriate place for registrations because it is called before the worker starts polling.
Task queue name is available via WorkerInterface::getID().
Parameters
- $worker : WorkerInterface
- $next : callable(WorkerInterface): void
-
Calls the next plugin or the final hook.
run()
Wraps the worker factory run lifecycle using chain-of-responsibility.
public
run(WorkerFactoryInterface $factory, callable(WorkerFactoryInterface): int $next) : int
Each plugin wraps the next one in the chain. The innermost call executes the actual processing loop. Plugins are chained in registration order: the first registered plugin is the outermost wrapper.
Use this to manage resources, add observability, or handle errors:
public function run(WorkerFactoryInterface $factory, callable $next): int
{
$pool = new ConnectionPool();
try {
return $next($factory);
} finally {
$pool->close();
}
}
Parameters
- $factory : WorkerFactoryInterface
- $next : callable(WorkerFactoryInterface): int
-
Calls the next plugin or the actual run loop.
Return values
intrunWorker()
public
runWorker(callable $handler, ServerRequestInterface $request, array<string|int, mixed> $headers, callable $next) : PromiseInterface
Parameters
- $handler : callable
- $request : ServerRequestInterface
- $headers : array<string|int, mixed>
- $next : callable