{"modulePath":"github.com/bborbe/agent-task-controller","version":"v0.38.3","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package factory\n\n## Functions\n\n```go\nfunc CreateCommandConsumer(\n\tsaramaClientProvider libkafka.SaramaClientProvider,\n\tsyncProducer libkafka.SyncProducer,\n\tdb libkv.DB,\n\tbatchSize libkafka.BatchSize,\n\ttopicPrefix base.TopicPrefix,\n\tresultWriter result.ResultWriter,\n\tresolver result.TaskPathResolver,\n\tvaultClient vaultapi.Client,\n\ttaskDir string,\n\tvaultName string,\n\tcurrentDateTime libtime.CurrentDateTimeGetter,\n\tk int,\n\tprCommenter prcomment.PRCommenter,\n\tm metrics.Metrics,\n\thumans result.HumanAssignees,\n\tverifier command.WriteVerifier,\n) (run.Func, run.Func)\n```\nCreateCommandConsumer wires a CQRS command consumer for agent-task-v1-request, together with the loop that re-drives the commands it had to park.\n\nbatchSize bounds how many messages share one libkv.Tx. The handler composition (cdb.CreateCommandMessageHandlerBatch) is already MessageHandlerBatchTx — one db.Update per batch — so a batch size of 1 makes every message pay its own BoltDB transaction and fsync. Raising it is the only lever that changes the transaction count; the handler choice itself is already the batch variant.\n\n```go\nfunc RetryConsumer(consumer run.Func, delay time.Duration) run.Func\n```\nRetryConsumer wraps a command consumer so a transient Kafka failure reconnects instead of terminating the process.\n\nThe consumer is expected to run for the life of the pod, so any return is a transport-level interruption — \\`kafka: error while consuming \\\u003ctopic\u003e/\\\u003cpartition\u003e: EOF\\`, \\`broker not connected\\` — and not a reason to exit. Propagating it reaches service.Run, which treats the error as fatal: the controller stops scanning and publishing until Kubernetes restarts it, every in-flight command waits out the restart, and the request topic accumulates lag that is then drained one message at a time. Measured 2026-10-22: six restarts in 5h31m, each preceded by a consume EOF at a lag of 257–265.\n\nThe retry stops only when ctx is done, so a shutdown is a clean nil rather than an error the caller would have to special-case.\n\n","path":"github.com/bborbe/agent-task-controller/pkg/factory","name":"factory","synopsis":"","isRedistributable":true}
