new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Temporal · Concepts · all subjects

tasks, queues & workers

6 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Dynamic Activity registration requirement

A Dynamic Activity must be registered with the Worker before it can be invoked.

Dynamic Activity registration in Go SDK

An Activity is registered as dynamic in the Go SDK using worker.RegisterDynamicActivity(). Only one Dynamic Activity can be present on a Worker.

Services registration in Workers using AddActivity

Services are registered in Workers by calling AddActivity() on the TemporalWorkerOptions object. The purpose of this registration is to make the Activity available for execution on that Worker. When a Worker is created with a specific task queue and activities are registered using AddActivity(), the Worker is then able to execute those activities when tasks arrive from the Temporal Server.

Worker registration for Standalone Activities

Example Worker setup for Standalone Activities: ```go package main import ( "github.com/temporalio/samples-go/standalone-activity/helloworld" "go.temporal.io/sdk/client" "go.temporal.io/sdk/contrib/envconfig" "go.temporal.io/sdk/worker" "log" ) func main() { c, err := client.Dial(envconfig.MustLoadDefaultClientOptions()) if err != nil { log.Fatalln("Unable to create client", err) } defer c.Close() w := worker.New(c, "standalone-activity-helloworld", worker.Options{}) w.RegisterActivity(helloworld.Activity) err = w.Run(worker.InterruptCh()) if err != nil { log.Fatalln("Unable to start worker", err) } } ``` Worker setup for Standalone Activities is identical to regular Activities: create a Worker, register the Activity, and call Run().

Worker setup for Standalone Activities

Running a Worker for Standalone Activities is the same as running a Worker for Workflow Activities: you create a WorkerFactory, register the Activity implementation with worker.registerActivitiesImplementations(), and call factory.start(). The Worker doesn't need to know whether the Activity will be invoked from a Workflow or as a Standalone Activity.

Standalone Activities example with Worker registration

ClientConfigProfile profile = ClientConfigProfile.load(); WorkflowServiceStubs service = WorkflowServiceStubs.newServiceStubs(profile.toWorkflowServiceStubsOptions()); WorkflowClient client = WorkflowClient.newInstance(service, profile.toWorkflowClientOptions()); WorkerFactory factory = WorkerFactory.newInstance(client); Worker worker = factory.newWorker(TASK_QUEUE); worker.registerActivitiesImplementations(new GreetingActivitiesImpl()); factory.start(); System.out.println("Worker running on task queue: " + TASK_QUEUE); This example shows how to create a Worker, register an Activity implementation, and start processing tasks for Standalone Activities.

Give your agent this brain