@@ -29,25 +29,18 @@ const (
2929// Config holds configuration parameters for initializing a DBOS context.
3030// DatabaseURL and AppName are required.
3131type Config struct {
32- AppName string // Application name for identification (required)
33- DatabaseURL string // DatabaseURL is a PostgreSQL connection string. Either this or SystemDBPool is required.
34- SystemDBPool * pgxpool.Pool // SystemDBPool is a custom System Database Pool. It's optional and takes precedence over DatabaseURL if both are provided.
35- DatabaseSchema string // Database schema name (defaults to "dbos")
36- Logger * slog.Logger // Custom logger instance (defaults to a new slog logger)
37- AdminServer bool // Enable Transact admin HTTP server (disabled by default)
38- AdminServerPort int // Port for the admin HTTP server (default: 3001)
39- ConductorURL string // DBOS conductor service URL (optional)
40- ConductorAPIKey string // DBOS conductor API key (optional)
41- ApplicationVersion string // Application version (optional, overridden by DBOS__APPVERSION env var)
42- ExecutorID string // Executor ID (optional, overridden by DBOS__VMID env var)
43- QueueRunner QueueConfig // Queue configuration (optional)
44- }
45-
46- // QueueConfig configures the queue runner polling behavior.
47- type QueueConfig struct {
48- BaseInterval float64 // seconds
49- MinInterval float64 // seconds
50- MaxInterval float64 // seconds
32+ AppName string // Application name for identification (required)
33+ DatabaseURL string // DatabaseURL is a PostgreSQL connection string. Either this or SystemDBPool is required.
34+ SystemDBPool * pgxpool.Pool // SystemDBPool is a custom System Database Pool. It's optional and takes precedence over DatabaseURL if both are provided.
35+ DatabaseSchema string // Database schema name (defaults to "dbos")
36+ Logger * slog.Logger // Custom logger instance (defaults to a new slog logger)
37+ AdminServer bool // Enable Transact admin HTTP server (disabled by default)
38+ AdminServerPort int // Port for the admin HTTP server (default: 3001)
39+ ConductorURL string // DBOS conductor service URL (optional)
40+ ConductorAPIKey string // DBOS conductor API key (optional)
41+ ApplicationVersion string // Application version (optional, overridden by DBOS__APPVERSION env var)
42+ ExecutorID string // Executor ID (optional, overridden by DBOS__VMID env var)
43+ QueueRunnerConfig QueueRunnerConfig // Queue runner configuration (optional)
5144}
5245
5346func processConfig (inputConfig * Config ) (* Config , error ) {
@@ -62,7 +55,7 @@ func processConfig(inputConfig *Config) (*Config, error) {
6255 inputConfig .AdminServerPort = _DEFAULT_ADMIN_SERVER_PORT
6356 }
6457
65- if inputConfig .QueueRunner .MinInterval > inputConfig .QueueRunner .MaxInterval {
58+ if inputConfig .QueueRunnerConfig .MinInterval > inputConfig .QueueRunnerConfig .MaxInterval {
6659 return nil , fmt .Errorf ("minInterval must be less than maxInterval" )
6760 }
6861
@@ -78,7 +71,7 @@ func processConfig(inputConfig *Config) (*Config, error) {
7871 ApplicationVersion : inputConfig .ApplicationVersion ,
7972 ExecutorID : inputConfig .ExecutorID ,
8073 SystemDBPool : inputConfig .SystemDBPool ,
81- QueueRunner : inputConfig .QueueRunner ,
74+ QueueRunnerConfig : inputConfig .QueueRunnerConfig ,
8275 }
8376
8477 // Load defaults
@@ -140,6 +133,7 @@ type DBOSContext interface {
140133 ListWorkflows (_ DBOSContext , opts ... ListWorkflowsOption ) ([]WorkflowStatus , error ) // List workflows based on filtering criteria
141134 GetWorkflowSteps (_ DBOSContext , workflowID string ) ([]StepInfo , error ) // Get the execution steps of a workflow
142135 ListRegisteredWorkflows (_ DBOSContext , opts ... ListRegisteredWorkflowsOption ) ([]WorkflowRegistryEntry , error ) // List registered workflows with filtering options
136+ ListRegisteredQueues () []WorkflowQueue // List all registered workflow queues
143137
144138 // Accessors
145139 GetApplicationVersion () string // Get the application version for this context
@@ -302,6 +296,14 @@ func (c *dbosContext) GetApplicationID() string {
302296 return c .applicationID
303297}
304298
299+ // ListRegisteredQueues returns all registered workflow queues.
300+ func (c * dbosContext ) ListRegisteredQueues () []WorkflowQueue {
301+ if c .queueRunner == nil {
302+ return []WorkflowQueue {}
303+ }
304+ return c .queueRunner .listQueues ()
305+ }
306+
305307// ListRegisteredWorkflows returns information about registered workflows with their registration parameters.
306308// Supports filtering using functional options.
307309func (c * dbosContext ) ListRegisteredWorkflows (_ DBOSContext , opts ... ListRegisteredWorkflowsOption ) ([]WorkflowRegistryEntry , error ) {
@@ -392,7 +394,7 @@ func NewDBOSContext(ctx context.Context, inputConfig Config) (DBOSContext, error
392394 initExecutor .logger .Debug ("System database initialized" )
393395
394396 // Initialize the queue runner and register DBOS internal queue
395- initExecutor .queueRunner = newQueueRunner (initExecutor .logger , config .QueueRunner )
397+ initExecutor .queueRunner = newQueueRunner (initExecutor .logger , config .QueueRunnerConfig )
396398
397399 // Initialize conductor if API key is provided
398400 if config .ConductorAPIKey != "" {
0 commit comments