Documentation

WorkerFactory
in package
implements WorkerFactoryInterface, LoopInterface uses EventEmitterTrait

WorkerFactory is primary entry point for the temporal application. This class is responsible for the communication with parent RoadRunner process and can be used to create taskQueue workflow and activity workers.

$factory = WorkerFactory::create();

$worker = $factory->newWorker('default');

$worker->registerWorkflowTypes(WorkflowType::class);
$worker->registerActivityImplementations(new MyActivityImplementation());

Table of Contents

Interfaces

WorkerFactoryInterface
The interface is responsible for providing an interface for registering all dependencies and creating a global event loop.
LoopInterface
The interface is responsible for providing an interface for creating an event loop.

Constants

ERROR_HEADER_NOT_STRING_TYPE  = 'Header "%s" argument type must be a string, but %s given'
ERROR_HEADERS_TYPE  = 'Received headers type must be a string, but %s given'
ERROR_MESSAGE_TYPE  = 'Received message type must be a string, but %s given'
ERROR_QUEUE_NOT_FOUND  = 'Cannot find a worker for task queue "%s"'
HEADER_TASK_QUEUE  = 'taskQueue'

Properties

$client  : ClientInterface
$codec  : CodecInterface
$converter  : DataConverterInterface
$env  : EnvironmentInterface
$marshaller  : MarshallerInterface<string|int, array<string|int, mixed>>
$queues  : RepositoryInterface<string|int, WorkerInterface>
$reader  : ReaderInterface
$responses  : QueueInterface
$router  : RouterInterface
$rpc  : RPCConnectionInterface
$server  : ServerInterface

Methods

__construct()  : mixed
create()  : WorkerFactoryInterface
getClient()  : ClientInterface
getDataConverter()  : DataConverterInterface
getEnvironment()  : EnvironmentInterface
getMarshaller()  : MarshallerInterface<string|int, array<string|int, mixed>>
getQueue()  : QueueInterface
getReader()  : ReaderInterface
newWorker()  : WorkerInterface
Create a new Temporal Worker with the name of the task queue and register in worker.
run()  : int
Start processing workflows and activities processing.
tick()  : void
createClient()  : ClientInterface
createMarshaller()  : MarshallerInterface<string|int, array<string|int, mixed>>
createQueue()  : QueueInterface
createReader()  : ReaderInterface
createRouter()  : RouterInterface
createServer()  : ServerInterface
createTaskQueue()  : RepositoryInterface<string|int, WorkerInterface>
boot()  : void
createCodec()  : CodecInterface
dispatch()  : string
findTaskQueueNameOrFail()  : string
findTaskQueueOrFail()  : WorkerInterface
onRequest()  : PromiseInterface

Constants

ERROR_HEADER_NOT_STRING_TYPE

private string ERROR_HEADER_NOT_STRING_TYPE = 'Header "%s" argument type must be a string, but %s given'

ERROR_HEADERS_TYPE

private string ERROR_HEADERS_TYPE = 'Received headers type must be a string, but %s given'

ERROR_MESSAGE_TYPE

private string ERROR_MESSAGE_TYPE = 'Received message type must be a string, but %s given'

ERROR_QUEUE_NOT_FOUND

private string ERROR_QUEUE_NOT_FOUND = 'Cannot find a worker for task queue "%s"'

HEADER_TASK_QUEUE

private string HEADER_TASK_QUEUE = 'taskQueue'

Properties

$marshaller

protected MarshallerInterface<string|int, array<string|int, mixed>> $marshaller

Methods

getClient()

public getClient() : ClientInterface
Return values
ClientInterface

getMarshaller()

public getMarshaller() : MarshallerInterface<string|int, array<string|int, mixed>>
Return values
MarshallerInterface<string|int, array<string|int, mixed>>

getQueue()

public getQueue() : QueueInterface
Return values
QueueInterface

getReader()

public getReader() : ReaderInterface
Return values
ReaderInterface

newWorker()

Create a new Temporal Worker with the name of the task queue and register in worker.

public newWorker([string $taskQueue = self::DEFAULT_TASK_QUEUE ][, WorkerOptions $options = null ][, ExceptionInterceptorInterface $exceptionInterceptor = null ][, PipelineProvider $interceptorProvider = null ]) : WorkerInterface
Parameters
$taskQueue : string = self::DEFAULT_TASK_QUEUE
$options : WorkerOptions = null
$exceptionInterceptor : ExceptionInterceptorInterface = null
$interceptorProvider : PipelineProvider = null
Return values
WorkerInterface

createClient()

protected createClient() : ClientInterface
Return values
ClientInterface

createMarshaller()

protected createMarshaller(ReaderInterface $reader) : MarshallerInterface<string|int, array<string|int, mixed>>
Parameters
$reader : ReaderInterface
Return values
MarshallerInterface<string|int, array<string|int, mixed>>

createQueue()

protected createQueue() : QueueInterface
Return values
QueueInterface

createReader()

protected createReader() : ReaderInterface
Return values
ReaderInterface

createRouter()

protected createRouter() : RouterInterface
Return values
RouterInterface

createServer()

protected createServer() : ServerInterface
Return values
ServerInterface

dispatch()

private dispatch(string $messages, array<string|int, mixed> $headers) : string
Parameters
$messages : string
$headers : array<string|int, mixed>
Return values
string

findTaskQueueNameOrFail()

private findTaskQueueNameOrFail(array<string|int, mixed> $headers) : string
Parameters
$headers : array<string|int, mixed>
Return values
string

        
On this page

Search results