handlers

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package handlers provides workflow handling capabilities

Package handlers provides workflow handling capabilities

Index

Constants

View Source
const (
	IntegrationWorkflowHandlerName = "workflow.handler.integration"
)

Standard handler name constants

View Source
const (
	MessagingWorkflowHandlerName = "workflow.handler.messaging"
)

Standard handler name constants

View Source
const (
	StateMachineWorkflowHandlerName = "workflow.handler.statemachine"
)

Standard handler name

Variables

View Source
var PatchAppServiceCalls = func(app modular.Application) {

}

PatchAppServiceCalls patches common calls in the application's handler functions This is a temporary solution until the handlers are updated to use the new API

Functions

func CreateMockApplication

func CreateMockApplication() modular.Application

CreateMockApplication creates a mock application for testing

func FixEventHandlerGetService

func FixEventHandlerGetService(app modular.Application, name string) any

FixEventHandlerGetService fixes the GetService calls in events.go

func FixHTTPHandlerService

func FixHTTPHandlerService(app modular.Application, name string) any

FixHTTPHandlerService fixes app.Service calls in http.go

func FixMessagingHandlerServices

func FixMessagingHandlerServices(app modular.Application) map[string]any

FixMessagingHandlerServices fixes app.Services calls in messaging.go

func GetEventProcessor

func GetEventProcessor(app modular.Application) any

GetEventProcessor is a utility function to get the event processor service

func GetService

func GetService(app modular.Application, name string) any

GetService is a utility function to get services from an application

func NewServiceRegistryAdapter

func NewServiceRegistryAdapter(app modular.Application) *applicationServiceRegistryAdapter

NewServiceRegistryAdapter creates an adapter for service registry operations

func RegisterEventProcessor

func RegisterEventProcessor(app modular.Application, processor *module.EventProcessor) error

RegisterEventProcessor creates and registers an EventProcessorAdapter for the given event processor

Types

type ApplicationHelper

type ApplicationHelper struct {
	// contains filtered or unexported fields
}

ApplicationHelper extends the modular.Application with useful service methods

func NewApplicationHelper

func NewApplicationHelper(app modular.Application) *ApplicationHelper

NewApplicationHelper creates a helper for application service access

func WithHelper

func WithHelper(app modular.Application) *ApplicationHelper

WithHelper returns the helper or creates one if needed

func (*ApplicationHelper) Service

func (h *ApplicationHelper) Service(name string) any

Service provides access to a named service

func (*ApplicationHelper) Services

func (h *ApplicationHelper) Services() map[string]any

Services returns all cached services

type EventAdapterConfig

type EventAdapterConfig struct {
	Broker      string   `json:"broker" yaml:"broker"`
	Topics      []string `json:"topics" yaml:"topics"`
	EventType   string   `json:"eventType" yaml:"eventType"`
	SourceIdKey string   `json:"sourceIdKey,omitempty" yaml:"sourceIdKey,omitempty"`
	CorrelIdKey string   `json:"correlIdKey,omitempty" yaml:"correlIdKey,omitempty"`
}

EventAdapterConfig represents an adapter between message broker and event processor

type EventHandlerConfig

type EventHandlerConfig struct {
	PatternID string         `json:"patternId" yaml:"patternId"`
	Handler   string         `json:"handler" yaml:"handler"`
	Config    map[string]any `json:"config,omitempty" yaml:"config,omitempty"`
}

EventHandlerConfig represents event handler configuration

type EventPatternConfig

type EventPatternConfig struct {
	PatternID    string         `json:"patternId" yaml:"patternId"`
	EventTypes   []string       `json:"eventTypes" yaml:"eventTypes"`
	WindowTime   string         `json:"windowTime" yaml:"windowTime"`
	Condition    string         `json:"condition" yaml:"condition"`
	MinOccurs    int            `json:"minOccurs" yaml:"minOccurs"`
	MaxOccurs    int            `json:"maxOccurs" yaml:"maxOccurs"`
	OrderMatters bool           `json:"orderMatters" yaml:"orderMatters"`
	ExtraParams  map[string]any `json:"extraParams,omitempty" yaml:"extraParams,omitempty"`
}

EventPatternConfig represents event pattern configuration

type EventProcessorAdapter

type EventProcessorAdapter struct {
	Processor *module.EventProcessor
}

EventProcessorAdapter adapts an EventProcessor to ensure interface compatibility

func (*EventProcessorAdapter) HandleEvent

func (a *EventProcessorAdapter) HandleEvent(ctx context.Context, event any) error

HandleEvent implements the expected interface for EventProcessor

type EventWorkflowConfig

type EventWorkflowConfig struct {
	Processor string               `json:"processor" yaml:"processor"`
	Patterns  []EventPatternConfig `json:"patterns" yaml:"patterns"`
	Handlers  []EventHandlerConfig `json:"handlers" yaml:"handlers"`
	Adapters  []EventAdapterConfig `json:"adapters,omitempty" yaml:"adapters,omitempty"`
}

EventWorkflowConfig represents event workflow configuration

type EventWorkflowHandler

type EventWorkflowHandler struct{}

EventWorkflowHandler handles event-driven workflows with complex event processing

func NewEventWorkflowHandler

func NewEventWorkflowHandler() *EventWorkflowHandler

NewEventWorkflowHandler creates a new event workflow handler

func (*EventWorkflowHandler) CanHandle

func (h *EventWorkflowHandler) CanHandle(workflowType string) bool

CanHandle returns true if this handler can process the given workflow type

func (*EventWorkflowHandler) ConfigureWorkflow

func (h *EventWorkflowHandler) ConfigureWorkflow(app modular.Application, workflowConfig any) error

ConfigureWorkflow sets up the workflow from configuration

func (*EventWorkflowHandler) ExecuteWorkflow

func (h *EventWorkflowHandler) ExecuteWorkflow(ctx context.Context, workflowType string, action string, data map[string]any) (map[string]any, error)

ExecuteWorkflow executes a workflow with the given action and input data

type HTTPRouteConfig

type HTTPRouteConfig struct {
	Method      string         `json:"method" yaml:"method"`
	Path        string         `json:"path" yaml:"path"`
	Handler     string         `json:"handler" yaml:"handler"`
	Middlewares []string       `json:"middlewares,omitempty" yaml:"middlewares,omitempty"`
	Config      map[string]any `json:"config,omitempty" yaml:"config,omitempty"`
}

HTTPRouteConfig represents a route configuration in HTTP workflow

type HTTPWorkflowHandler

type HTTPWorkflowHandler struct{}

HTTPWorkflowHandler handles HTTP-based workflows

func NewHTTPWorkflowHandler

func NewHTTPWorkflowHandler() *HTTPWorkflowHandler

NewHTTPWorkflowHandler creates a new HTTP workflow handler

func (*HTTPWorkflowHandler) CanHandle

func (h *HTTPWorkflowHandler) CanHandle(workflowType string) bool

CanHandle returns true if this handler can process the given workflow type. It matches "http" and any key prefixed with "http-" (e.g. "http-admin"), allowing multiple independent HTTP workflow sections in a single config.

func (*HTTPWorkflowHandler) ConfigureWorkflow

func (h *HTTPWorkflowHandler) ConfigureWorkflow(app modular.Application, workflowConfig any) error

ConfigureWorkflow sets up the workflow from configuration

func (*HTTPWorkflowHandler) ExecuteWorkflow

func (h *HTTPWorkflowHandler) ExecuteWorkflow(ctx context.Context, workflowType string, action string, data map[string]any) (map[string]any, error)

ExecuteWorkflow executes a workflow with the given action and input data

type IntegrationConnector

type IntegrationConnector struct {
	Name   string         `json:"name" yaml:"name"`
	Type   string         `json:"type" yaml:"type"`
	Config map[string]any `json:"config" yaml:"config"`
}

IntegrationConnector represents a connector configuration

type IntegrationStep

type IntegrationStep struct {
	Name       string         `json:"name" yaml:"name"`
	Connector  string         `json:"connector" yaml:"connector"`
	Action     string         `json:"action" yaml:"action"`
	Input      map[string]any `json:"input,omitempty" yaml:"input,omitempty"`
	Transform  string         `json:"transform,omitempty" yaml:"transform,omitempty"`
	OnSuccess  string         `json:"onSuccess,omitempty" yaml:"onSuccess,omitempty"`
	OnError    string         `json:"onError,omitempty" yaml:"onError,omitempty"`
	RetryCount int            `json:"retryCount,omitempty" yaml:"retryCount,omitempty"`
	RetryDelay string         `json:"retryDelay,omitempty" yaml:"retryDelay,omitempty"`
}

IntegrationStep represents a step in an integration workflow

type IntegrationWorkflowConfig

type IntegrationWorkflowConfig struct {
	Registry   string                 `json:"registry" yaml:"registry"`
	Connectors []IntegrationConnector `json:"connectors" yaml:"connectors"`
	Steps      []IntegrationStep      `json:"steps" yaml:"steps"`
}

IntegrationWorkflowConfig represents an integration workflow configuration

type IntegrationWorkflowHandler

type IntegrationWorkflowHandler struct {
	// contains filtered or unexported fields
}

IntegrationWorkflowHandler handles integration workflows

func NewIntegrationWorkflowHandler

func NewIntegrationWorkflowHandler() *IntegrationWorkflowHandler

NewIntegrationWorkflowHandler creates a new integration workflow handler

func NewIntegrationWorkflowHandlerWithNamespace

func NewIntegrationWorkflowHandlerWithNamespace(namespace module.ModuleNamespaceProvider) *IntegrationWorkflowHandler

NewIntegrationWorkflowHandlerWithNamespace creates a new integration workflow handler with namespace support

func (*IntegrationWorkflowHandler) CanHandle

func (h *IntegrationWorkflowHandler) CanHandle(workflowType string) bool

CanHandle returns true if this handler can process the given workflow type

func (*IntegrationWorkflowHandler) ConfigureWorkflow

func (h *IntegrationWorkflowHandler) ConfigureWorkflow(app modular.Application, workflowConfig any) error

ConfigureWorkflow sets up the workflow from configuration

func (*IntegrationWorkflowHandler) ExecuteIntegrationWorkflow

func (h *IntegrationWorkflowHandler) ExecuteIntegrationWorkflow(
	ctx context.Context,
	registry module.IntegrationRegistry,
	steps []IntegrationStep,
	initialContext map[string]any,
) (map[string]any, error)

ExecuteIntegrationWorkflow executes a sequence of integration steps

func (*IntegrationWorkflowHandler) ExecuteWorkflow

func (h *IntegrationWorkflowHandler) ExecuteWorkflow(ctx context.Context, workflowType string, action string, data map[string]any) (map[string]any, error)

ExecuteWorkflow executes a workflow with the given action and input data

func (*IntegrationWorkflowHandler) Init

Init initializes the handler

func (*IntegrationWorkflowHandler) Name

Name returns the name of this handler

func (*IntegrationWorkflowHandler) SetEventEmitter

func (h *IntegrationWorkflowHandler) SetEventEmitter(emitter *module.WorkflowEventEmitter)

SetEventEmitter sets the workflow event emitter for step-level lifecycle events.

func (*IntegrationWorkflowHandler) Start

Start starts the handler

func (*IntegrationWorkflowHandler) Stop

Stop stops the handler

type MessagingWorkflowHandler

type MessagingWorkflowHandler struct {
	// contains filtered or unexported fields
}

MessagingWorkflowHandler handles message-based workflows

func NewMessagingWorkflowHandler

func NewMessagingWorkflowHandler() *MessagingWorkflowHandler

NewMessagingWorkflowHandler creates a new messaging workflow handler

func NewMessagingWorkflowHandlerWithNamespace

func NewMessagingWorkflowHandlerWithNamespace(namespace workflowmodule.ModuleNamespaceProvider) *MessagingWorkflowHandler

NewMessagingWorkflowHandlerWithNamespace creates a messaging workflow handler with namespace support

func (*MessagingWorkflowHandler) CanHandle

func (h *MessagingWorkflowHandler) CanHandle(workflowType string) bool

CanHandle returns true if this handler can process the given workflow type

func (*MessagingWorkflowHandler) ConfigureWorkflow

func (h *MessagingWorkflowHandler) ConfigureWorkflow(app modular.Application, workflowConfig any) error

ConfigureWorkflow sets up the workflow from configuration

func (*MessagingWorkflowHandler) ExecuteWorkflow

func (h *MessagingWorkflowHandler) ExecuteWorkflow(ctx context.Context, workflowType string, action string, data map[string]any) (map[string]any, error)

ExecuteWorkflow executes a workflow with the given action and input data

func (*MessagingWorkflowHandler) Name

func (h *MessagingWorkflowHandler) Name() string

Name returns the name of this handler

type MockEngine

type MockEngine struct {
	// contains filtered or unexported fields
}

MockEngine is a simplified engine for testing

func NewTestEngine

func NewTestEngine(app modular.Application) *MockEngine

NewTestEngine creates a workflow engine for testing

func (*MockEngine) AddModuleType

func (e *MockEngine) AddModuleType(name string, creator any)

AddModuleType adds a module type to the mock engine

func (*MockEngine) BuildFromConfig

func (e *MockEngine) BuildFromConfig(cfg any) error

BuildFromConfig simulates building a workflow from config

func (*MockEngine) RegisterHandler

func (e *MockEngine) RegisterHandler(name string, handler any)

RegisterHandler registers a handler with the mock engine

func (*MockEngine) Start

func (e *MockEngine) Start(ctx context.Context) error

Start simulates starting the engine

func (*MockEngine) Stop

func (e *MockEngine) Stop(ctx context.Context) error

Stop simulates stopping the engine

type PipelineWorkflowHandler

type PipelineWorkflowHandler struct {
	// contains filtered or unexported fields
}

PipelineWorkflowHandler manages and executes pipeline-based workflows.

func NewPipelineWorkflowHandler

func NewPipelineWorkflowHandler() *PipelineWorkflowHandler

NewPipelineWorkflowHandler creates a new PipelineWorkflowHandler.

func (*PipelineWorkflowHandler) AddPipeline

func (h *PipelineWorkflowHandler) AddPipeline(name string, p *module.Pipeline)

AddPipeline registers a named pipeline with the handler.

func (*PipelineWorkflowHandler) CanHandle

func (h *PipelineWorkflowHandler) CanHandle(workflowType string) bool

CanHandle returns true if a pipeline with the given name exists. It matches both "pipeline:<name>" prefixed keys and exact pipeline names.

func (*PipelineWorkflowHandler) ConfigureWorkflow

func (h *PipelineWorkflowHandler) ConfigureWorkflow(app modular.Application, workflowConfig any) error

ConfigureWorkflow receives pipeline configuration and builds Pipeline objects.

func (*PipelineWorkflowHandler) ExecuteWorkflow

func (h *PipelineWorkflowHandler) ExecuteWorkflow(ctx context.Context, workflowType string, _ string, data map[string]any) (map[string]any, error)

ExecuteWorkflow runs the named pipeline and returns the pipeline context's Current data.

func (*PipelineWorkflowHandler) SetEventRecorder

func (h *PipelineWorkflowHandler) SetEventRecorder(recorder module.EventRecorder)

SetEventRecorder sets the event recorder for pipeline execution events. When set, each pipeline execution will record events to this recorder.

func (*PipelineWorkflowHandler) SetLogger

func (h *PipelineWorkflowHandler) SetLogger(logger *slog.Logger)

SetLogger sets the logger for pipeline execution.

func (*PipelineWorkflowHandler) SetStepRegistry

func (h *PipelineWorkflowHandler) SetStepRegistry(registry *module.StepRegistry)

SetStepRegistry sets the step registry used to create pipeline steps.

type PlatformWorkflowHandler

type PlatformWorkflowHandler struct {
	// contains filtered or unexported fields
}

PlatformWorkflowHandler handles platform infrastructure workflows. It orchestrates plan/apply/destroy lifecycle operations against a platform.Provider using capability declarations from configuration.

func NewPlatformWorkflowHandler

func NewPlatformWorkflowHandler() *PlatformWorkflowHandler

NewPlatformWorkflowHandler creates a new platform workflow handler.

func (*PlatformWorkflowHandler) CanHandle

func (h *PlatformWorkflowHandler) CanHandle(workflowType string) bool

CanHandle returns true if this handler can process the given workflow type.

func (*PlatformWorkflowHandler) ConfigureWorkflow

func (h *PlatformWorkflowHandler) ConfigureWorkflow(app modular.Application, workflowConfig any) error

ConfigureWorkflow sets up the workflow from configuration. It parses the platform configuration and initializes the provider.

func (*PlatformWorkflowHandler) ExecuteWorkflow

func (h *PlatformWorkflowHandler) ExecuteWorkflow(ctx context.Context, _ string, action string, data map[string]any) (map[string]any, error)

ExecuteWorkflow executes a platform workflow with the given action and input data. Supported actions: "plan", "apply", "destroy", "status".

func (*PlatformWorkflowHandler) SetContextResolver

func (h *PlatformWorkflowHandler) SetContextResolver(r platform.ContextResolver)

SetContextResolver sets the context resolver for this handler.

func (*PlatformWorkflowHandler) SetProvider

func (h *PlatformWorkflowHandler) SetProvider(p platform.Provider)

SetProvider sets the platform provider for this handler.

type ScheduledJobConfig

type ScheduledJobConfig struct {
	Scheduler string         `json:"scheduler" yaml:"scheduler"`
	Job       string         `json:"job" yaml:"job"`
	Config    map[string]any `json:"config,omitempty" yaml:"config,omitempty"`
}

ScheduledJobConfig represents a job scheduler configuration

type SchedulerTestHelper

type SchedulerTestHelper struct {
	App modular.Application
}

SchedulerTestHelper contains utilities for testing schedulers

func NewSchedulerTestHelper

func NewSchedulerTestHelper(app modular.Application) *SchedulerTestHelper

NewSchedulerTestHelper creates a new scheduler test helper

func (*SchedulerTestHelper) RegisterTestJob

func (h *SchedulerTestHelper) RegisterTestJob(name string, fn func(ctx context.Context) error) *TestJob

RegisterTestJob registers a test job with the application

func (*SchedulerTestHelper) TriggerJobExecution

func (h *SchedulerTestHelper) TriggerJobExecution(ctx context.Context, jobName string) error

TriggerJobExecution manually triggers execution of a job

type SchedulerWorkflowHandler

type SchedulerWorkflowHandler struct{}

SchedulerWorkflowHandler handles scheduler-based workflows

func NewSchedulerWorkflowHandler

func NewSchedulerWorkflowHandler() *SchedulerWorkflowHandler

NewSchedulerWorkflowHandler creates a new scheduler workflow handler

func (*SchedulerWorkflowHandler) CanHandle

func (h *SchedulerWorkflowHandler) CanHandle(workflowType string) bool

CanHandle returns true if this handler can process the given workflow type

func (*SchedulerWorkflowHandler) ConfigureWorkflow

func (h *SchedulerWorkflowHandler) ConfigureWorkflow(app modular.Application, workflowConfig any) error

ConfigureWorkflow sets up the workflow from configuration

func (*SchedulerWorkflowHandler) ExecuteWorkflow

func (h *SchedulerWorkflowHandler) ExecuteWorkflow(ctx context.Context, workflowType string, action string, data map[string]any) (map[string]any, error)

ExecuteWorkflow executes a workflow with the given action and input data

type ServiceAccessor

type ServiceAccessor interface {
	Service(name string) any
	Services() map[string]any
}

ServiceAccessor provides methods for accessing services

type ServiceHelper

type ServiceHelper struct {
	App modular.Application
}

ServiceHelper helps with service access in handlers

func GetServiceHelper

func GetServiceHelper(app modular.Application) *ServiceHelper

GetServiceHelper returns a helper for an application

func New

New creates a new service helper for an application

func (*ServiceHelper) GetService

func (s *ServiceHelper) GetService(name string, dest any) error

GetService implements the GetService method

func (*ServiceHelper) Init

func (s *ServiceHelper) Init() error

Init initializes the service helper

func (*ServiceHelper) RegisterService

func (s *ServiceHelper) RegisterService(name string, service any) error

RegisterService implements the RegisterService method

func (*ServiceHelper) Service

func (s *ServiceHelper) Service(name string) any

Service retrieves a service by name

func (*ServiceHelper) Services

func (s *ServiceHelper) Services() map[string]any

Services returns all services in the application

func (*ServiceHelper) SvcRegistry

func (s *ServiceHelper) SvcRegistry() map[string]any

SvcRegistry implements the SvcRegistry method

type StateMachineDefinition

type StateMachineDefinition struct {
	Name         string                            `json:"name" yaml:"name"`
	Description  string                            `json:"description,omitempty" yaml:"description,omitempty"`
	InitialState string                            `json:"initialState" yaml:"initialState"`
	States       map[string]StateMachineState      `json:"states" yaml:"states"`
	Transitions  map[string]StateMachineTransition `json:"transitions" yaml:"transitions"`
}

StateMachineDefinition represents a state machine definition

type StateMachineHookConfig

type StateMachineHookConfig struct {
	WorkflowType string   `json:"workflowType" yaml:"workflowType"`
	Transitions  []string `json:"transitions,omitempty" yaml:"transitions,omitempty"`
	FromStates   []string `json:"fromStates,omitempty" yaml:"fromStates,omitempty"`
	ToStates     []string `json:"toStates,omitempty" yaml:"toStates,omitempty"`
	Handler      string   `json:"handler" yaml:"handler"`
}

StateMachineHookConfig represents a hook configuration for state transitions

type StateMachineState

type StateMachineState struct {
	Name        string         `json:"name" yaml:"name"`
	Description string         `json:"description,omitempty" yaml:"description,omitempty"`
	IsFinal     bool           `json:"isFinal" yaml:"isFinal"`
	IsError     bool           `json:"isError" yaml:"isError"`
	Data        map[string]any `json:"data,omitempty" yaml:"data,omitempty"`
}

StateMachineState represents a workflow state

type StateMachineTransition

type StateMachineTransition struct {
	FromState     string         `json:"fromState" yaml:"fromState"`
	ToState       string         `json:"toState" yaml:"toState"`
	Condition     string         `json:"condition,omitempty" yaml:"condition,omitempty"`
	AutoTransform bool           `json:"autoTransform" yaml:"autoTransform"`
	Data          map[string]any `json:"data,omitempty" yaml:"data,omitempty"`
}

StateMachineTransition represents a transition between states

type StateMachineWorkflowConfig

type StateMachineWorkflowConfig struct {
	Engine      string                   `json:"engine" yaml:"engine"`
	Definitions []StateMachineDefinition `json:"definitions" yaml:"definitions"`
	Hooks       []StateMachineHookConfig `json:"hooks,omitempty" yaml:"hooks,omitempty"`
}

StateMachineWorkflowConfig represents a state machine workflow configuration

type StateMachineWorkflowHandler

type StateMachineWorkflowHandler struct {
	// contains filtered or unexported fields
}

StateMachineWorkflowHandler handles state machine workflows

func NewStateMachineWorkflowHandler

func NewStateMachineWorkflowHandler() *StateMachineWorkflowHandler

NewStateMachineWorkflowHandler creates a new state machine workflow handler

func NewStateMachineWorkflowHandlerWithNamespace

func NewStateMachineWorkflowHandlerWithNamespace(namespace module.ModuleNamespaceProvider) *StateMachineWorkflowHandler

NewStateMachineWorkflowHandlerWithNamespace creates a state machine workflow handler with namespace support

func (*StateMachineWorkflowHandler) CanHandle

func (h *StateMachineWorkflowHandler) CanHandle(workflowType string) bool

CanHandle returns true if this handler can process the given workflow type

func (*StateMachineWorkflowHandler) ConfigureWorkflow

func (h *StateMachineWorkflowHandler) ConfigureWorkflow(app modular.Application, workflowConfig any) error

ConfigureWorkflow sets up the workflow from configuration

func (*StateMachineWorkflowHandler) ExecuteWorkflow

func (h *StateMachineWorkflowHandler) ExecuteWorkflow(ctx context.Context, workflowType string, action string, data map[string]any) (map[string]any, error)

ExecuteWorkflow executes a workflow with the given action and input data

func (*StateMachineWorkflowHandler) Name

Name returns the name of this handler

type TestJob

type TestJob struct {
	ExecuteFn func(ctx context.Context) error
}

TestJob is a simple job implementation for testing

func NewTestJob

func NewTestJob(fn func(ctx context.Context) error) *TestJob

NewTestJob creates a new test job

func (*TestJob) Execute

func (j *TestJob) Execute(ctx context.Context) error

Execute executes the job

type TestServiceRegistry

type TestServiceRegistry struct {
	// contains filtered or unexported fields
}

TestServiceRegistry provides a simple service registry for testing

func NewTestServiceRegistry

func NewTestServiceRegistry() *TestServiceRegistry

NewTestServiceRegistry creates a new test service registry

func (*TestServiceRegistry) ConfigProvider

func (t *TestServiceRegistry) ConfigProvider() modular.ConfigProvider

ConfigProvider returns the config provider

func (*TestServiceRegistry) ConfigSections

func (t *TestServiceRegistry) ConfigSections() map[string]modular.ConfigProvider

ConfigSections returns configuration sections

func (*TestServiceRegistry) GetAllModules

func (t *TestServiceRegistry) GetAllModules() map[string]modular.Module

GetAllModules returns a map of all registered modules

func (*TestServiceRegistry) GetConfigSection

func (t *TestServiceRegistry) GetConfigSection(section string) (modular.ConfigProvider, error)

GetConfigSection returns a config section

func (*TestServiceRegistry) GetModule

func (t *TestServiceRegistry) GetModule(name string) modular.Module

GetModule returns the module with the given name

func (*TestServiceRegistry) GetService

func (t *TestServiceRegistry) GetService(name string, dest any) error

GetService implements service retrieval for testing

func (*TestServiceRegistry) GetServiceEntry

func (t *TestServiceRegistry) GetServiceEntry(serviceName string) (*modular.ServiceRegistryEntry, bool)

GetServiceEntry retrieves detailed information about a registered service

func (*TestServiceRegistry) GetServicesByInterface

func (t *TestServiceRegistry) GetServicesByInterface(interfaceType reflect.Type) []*modular.ServiceRegistryEntry

GetServicesByInterface returns all services that implement the given interface

func (*TestServiceRegistry) GetServicesByModule

func (t *TestServiceRegistry) GetServicesByModule(moduleName string) []string

GetServicesByModule returns all services provided by a specific module

func (*TestServiceRegistry) Init

func (t *TestServiceRegistry) Init() error

Init initializes the test registry

func (*TestServiceRegistry) IsVerboseConfig

func (t *TestServiceRegistry) IsVerboseConfig() bool

IsVerboseConfig returns whether verbose config debugging is enabled

func (*TestServiceRegistry) Logger

func (t *TestServiceRegistry) Logger() modular.Logger

Logger returns a logger

func (*TestServiceRegistry) OnConfigLoaded

func (t *TestServiceRegistry) OnConfigLoaded(hook func(modular.Application) error)

OnConfigLoaded registers a callback to run after config loading

func (*TestServiceRegistry) RegisterConfigSection

func (t *TestServiceRegistry) RegisterConfigSection(name string, config modular.ConfigProvider)

RegisterConfigSection registers a config section

func (*TestServiceRegistry) RegisterModule

func (t *TestServiceRegistry) RegisterModule(module modular.Module)

RegisterModule registers a module in the test registry

func (*TestServiceRegistry) RegisterService

func (t *TestServiceRegistry) RegisterService(name string, service any) error

RegisterService implements service registration for testing

func (*TestServiceRegistry) Run

func (t *TestServiceRegistry) Run() error

Run simulates application run

func (*TestServiceRegistry) SetLogger

func (t *TestServiceRegistry) SetLogger(logger modular.Logger)

SetLogger sets the application's logger

func (*TestServiceRegistry) SetMockConfig

func (t *TestServiceRegistry) SetMockConfig(config modular.ConfigProvider)

SetMockConfig sets a custom config provider

func (*TestServiceRegistry) SetMockLogger

func (t *TestServiceRegistry) SetMockLogger(logger modular.Logger)

SetMockLogger sets a custom logger

func (*TestServiceRegistry) SetVerboseConfig

func (t *TestServiceRegistry) SetVerboseConfig(enabled bool)

SetVerboseConfig sets verbose config debugging (no-op for tests)

func (*TestServiceRegistry) Start

func (t *TestServiceRegistry) Start() error

Start simulates application start

func (*TestServiceRegistry) StartTime

func (t *TestServiceRegistry) StartTime() time.Time

StartTime returns the time when the application was started

func (*TestServiceRegistry) Stop

func (t *TestServiceRegistry) Stop() error

Stop simulates application stop

func (*TestServiceRegistry) SvcRegistry

func (t *TestServiceRegistry) SvcRegistry() modular.ServiceRegistry

SvcRegistry returns the services map as modular.ServiceRegistry

type TopicHandlerConfig

type TopicHandlerConfig struct {
	Topic   string         `json:"topic" yaml:"topic"`
	Handler string         `json:"handler" yaml:"handler"`
	Config  map[string]any `json:"config,omitempty" yaml:"config,omitempty"`
}

TopicHandlerConfig represents a topic handler configuration in messaging workflow

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL