Files
tasks/service/history/queues/executable_factory.go
zeekay 40351cce6f rip: delete temporal fork — native ZAP-only tasksd
Goes from 135 MB binary with 1153 files importing go.temporal.io and 224
importing google.golang.org/grpc to a 10 MB native binary with ZERO of
either.

Deleted:
- tasks/, tasktests/, service/, chasm/, client/, api/, proto/, tools/
- cmd/tools/, components/, docker/
- schema/{cassandra,elasticsearch,mysql,postgresql,sqlite}/
- 40 tainted common/ subdirs + 7 top-level common files
- tests/testutils (no longer referenced after surviving deps drop common)

New cmd/tasksd (~100 lines) boots tasks.Embed (zap.Node) + http.Server.
New pkg/tasks/embed.go registers ZAP handlers for the SDK opcode surface
(0x0060-0x00A5). Workflow handlers return a 501 "not yet implemented"
envelope; native engine lands behind this contract.

Build:  go build ./cmd/tasksd → 10 MB
Vet:    go vet ./... → clean
Boot:   tasksd --zap-port 9999 --http :7243
Probes: /healthz, /v1/tasks/health → 200
UI:     /_/tasks/, / → 200 (embedded Vite bundle)
ZAP:    _tasks._tcp on :9999 (mDNS disabled; direct connect)

go.mod: tidy. No go.temporal.io. No google.golang.org/grpc.
2026-04-26 14:06:21 -07:00

113 lines
3.8 KiB
Go

package queues
import (
"go.opentelemetry.io/otel/trace"
"go.temporal.io/server/chasm"
"go.temporal.io/server/common/clock"
"go.temporal.io/server/common/cluster"
"go.temporal.io/server/common/dynamicconfig"
"go.temporal.io/server/common/log"
"go.temporal.io/server/common/metrics"
"go.temporal.io/server/common/namespace"
"go.temporal.io/server/service/history/tasks"
)
type (
// ExecutableFactory and the related interfaces here are needed to make it possible to extend the functionality of
// task processing without changing its core logic. This is similar to ExecutorWrapper.
ExecutableFactory interface {
NewExecutable(task tasks.Task, readerID int64) Executable
}
// ExecutableFactoryFn is a convenience type to avoid having to create a struct that implements ExecutableFactory.
ExecutableFactoryFn func(readerID int64, t tasks.Task) Executable
executableFactoryImpl struct {
executor Executor
scheduler Scheduler
rescheduler Rescheduler
priorityAssigner PriorityAssigner
timeSource clock.TimeSource
namespaceRegistry namespace.Registry
clusterMetadata cluster.Metadata
chasmRegistry *chasm.Registry
taskTypeTagProvider TaskTypeTagProvider
logger log.Logger
metricsHandler metrics.Handler
tracer trace.Tracer
dlqWriter *DLQWriter
dlqEnabled dynamicconfig.BoolPropertyFn
attemptsBeforeSendingToDlq dynamicconfig.IntPropertyFn
dlqInternalErrors dynamicconfig.BoolPropertyFn
dlqErrorPattern dynamicconfig.StringPropertyFn
}
)
func (f ExecutableFactoryFn) NewExecutable(task tasks.Task, readerID int64) Executable {
return f(readerID, task)
}
func NewExecutableFactory(
executor Executor,
scheduler Scheduler,
rescheduler Rescheduler,
priorityAssigner PriorityAssigner,
timeSource clock.TimeSource,
namespaceRegistry namespace.Registry,
clusterMetadata cluster.Metadata,
chasmRegistry *chasm.Registry,
taskTypeTagProvider TaskTypeTagProvider,
logger log.Logger,
metricsHandler metrics.Handler,
tracer trace.Tracer,
dlqWriter *DLQWriter,
dlqEnabled dynamicconfig.BoolPropertyFn,
attemptsBeforeSendingToDlq dynamicconfig.IntPropertyFn,
dlqInternalErrors dynamicconfig.BoolPropertyFn,
dlqErrorPattern dynamicconfig.StringPropertyFn,
) *executableFactoryImpl {
return &executableFactoryImpl{
executor: executor,
scheduler: scheduler,
rescheduler: rescheduler,
priorityAssigner: priorityAssigner,
timeSource: timeSource,
namespaceRegistry: namespaceRegistry,
clusterMetadata: clusterMetadata,
chasmRegistry: chasmRegistry,
taskTypeTagProvider: taskTypeTagProvider,
logger: logger,
metricsHandler: metricsHandler,
tracer: tracer,
dlqWriter: dlqWriter,
dlqEnabled: dlqEnabled,
attemptsBeforeSendingToDlq: attemptsBeforeSendingToDlq,
dlqInternalErrors: dlqInternalErrors,
dlqErrorPattern: dlqErrorPattern,
}
}
func (f *executableFactoryImpl) NewExecutable(task tasks.Task, readerID int64) Executable {
return NewExecutable(
readerID,
task,
f.executor,
f.scheduler,
f.rescheduler,
f.priorityAssigner,
f.timeSource,
f.namespaceRegistry,
f.clusterMetadata,
f.chasmRegistry,
f.taskTypeTagProvider,
f.logger,
f.metricsHandler,
f.tracer,
func(params *ExecutableParams) {
params.DLQEnabled = f.dlqEnabled
params.DLQWriter = f.dlqWriter
params.MaxUnexpectedErrorAttempts = f.attemptsBeforeSendingToDlq
params.DLQInternalErrors = f.dlqInternalErrors
params.DLQErrorPattern = f.dlqErrorPattern
},
)
}