Documentation
¶
Overview ¶
Package module defines core interfaces for the workflow engine
Index ¶
- Constants
- func BuildDeleteSQL(table string, where string, whereArgs ...interface{}) (string, []interface{})
- func BuildInsertSQL(table string, data map[string]interface{}) (string, []interface{})
- func BuildUpdateSQL(table string, data map[string]interface{}, where string, ...) (string, []interface{})
- func CalculateBackoff(initialBackoff time.Duration, multiplier float64, maxBackoff time.Duration, ...) time.Duration
- func CreateIsolatedApp(t *testing.T) modular.Application
- func GetRequestID(ctx context.Context) string
- func SkipTestWithContext(ctx context.Context, skip bool) context.Context
- func StepTopic(workflowType, stepName, lifecycle string) string
- func WorkflowTopic(workflowType, lifecycle string) string
- type AuthMiddleware
- func (m *AuthMiddleware) AddProvider(validTokens map[string]map[string]interface{})
- func (m *AuthMiddleware) Init(app modular.Application) error
- func (m *AuthMiddleware) Name() string
- func (m *AuthMiddleware) Process(next http.Handler) http.Handler
- func (m *AuthMiddleware) ProvidesServices() []modular.ServiceProvider
- func (m *AuthMiddleware) RegisterProvider(provider AuthProvider)
- func (m *AuthMiddleware) RequiresServices() []modular.ServiceDependency
- func (m *AuthMiddleware) Start(ctx context.Context) error
- func (m *AuthMiddleware) Stop(ctx context.Context) error
- type AuthProvider
- type CORSMiddleware
- func (m *CORSMiddleware) Init(app modular.Application) error
- func (m *CORSMiddleware) Name() string
- func (m *CORSMiddleware) Process(next http.Handler) http.Handler
- func (m *CORSMiddleware) ProvidesServices() []modular.ServiceProvider
- func (m *CORSMiddleware) RequiresServices() []modular.ServiceDependency
- func (m *CORSMiddleware) Start(ctx context.Context) error
- func (m *CORSMiddleware) Stop(ctx context.Context) error
- type CompositeTransitionHandler
- type CronScheduler
- type CrossWorkflowRouter
- type DataTransformer
- func (dt *DataTransformer) Init(app modular.Application) error
- func (dt *DataTransformer) Name() string
- func (dt *DataTransformer) RegisterPipeline(pipeline *TransformPipeline)
- func (dt *DataTransformer) Transform(ctx context.Context, pipelineName string, data interface{}) (interface{}, error)
- func (dt *DataTransformer) TransformWithOps(ctx context.Context, ops []TransformOperation, data interface{}) (interface{}, error)
- type DatabaseConfig
- type DatabaseIntegrationConnector
- func (c *DatabaseIntegrationConnector) Connect(ctx context.Context) error
- func (c *DatabaseIntegrationConnector) Disconnect(ctx context.Context) error
- func (c *DatabaseIntegrationConnector) Execute(ctx context.Context, action string, params map[string]interface{}) (map[string]interface{}, error)
- func (c *DatabaseIntegrationConnector) GetName() string
- func (c *DatabaseIntegrationConnector) IsConnected() bool
- type EventBusBridge
- func (b *EventBusBridge) Consumer() MessageConsumer
- func (b *EventBusBridge) Init(app modular.Application) error
- func (b *EventBusBridge) InitFromApp(app modular.Application) error
- func (b *EventBusBridge) Name() string
- func (b *EventBusBridge) Producer() MessageProducer
- func (b *EventBusBridge) SendMessage(topic string, message []byte) error
- func (b *EventBusBridge) SetEventBus(eb *eventbus.EventBusModule)
- func (b *EventBusBridge) Start(_ context.Context) error
- func (b *EventBusBridge) Stop(_ context.Context) error
- func (b *EventBusBridge) Subscribe(topic string, handler MessageHandler) error
- func (b *EventBusBridge) Unsubscribe(topic string) error
- type EventBusTrigger
- func (t *EventBusTrigger) Configure(app modular.Application, triggerConfig interface{}) error
- func (t *EventBusTrigger) Init(app modular.Application) error
- func (t *EventBusTrigger) Name() string
- func (t *EventBusTrigger) SetEventBusAndEngine(eb *eventbus.EventBusModule, engine WorkflowEngine)
- func (t *EventBusTrigger) Start(ctx context.Context) error
- func (t *EventBusTrigger) Stop(_ context.Context) error
- type EventBusTriggerSubscription
- type EventData
- type EventHandler
- type EventPattern
- type EventProcessor
- func (p *EventProcessor) AddPattern(pattern *EventPattern)
- func (p *EventProcessor) Error() string
- func (p *EventProcessor) GetService(name string, out interface{}) error
- func (p *EventProcessor) Init(app modular.Application) error
- func (p *EventProcessor) Name() string
- func (p *EventProcessor) ProcessEvent(ctx context.Context, event EventData) error
- func (p *EventProcessor) ProvidesServices() []modular.ServiceProvider
- func (p *EventProcessor) RegisterHandler(patternID string, handler EventHandler) error
- func (p *EventProcessor) RequiresServices() []modular.ServiceDependency
- func (p *EventProcessor) Service(name string) interface{}
- func (p *EventProcessor) Services() map[string]interface{}
- func (p *EventProcessor) SetError(err error)
- func (p *EventProcessor) Start(ctx context.Context) error
- func (p *EventProcessor) Stop(ctx context.Context) error
- type EventProcessorLocator
- type EventTrigger
- func (t *EventTrigger) Configure(app modular.Application, triggerConfig interface{}) error
- func (t *EventTrigger) Init(app modular.Application) error
- func (t *EventTrigger) Name() string
- func (t *EventTrigger) SetBrokerAndEngine(broker MessageBroker, engine WorkflowEngine)
- func (t *EventTrigger) Start(ctx context.Context) error
- func (t *EventTrigger) Stop(ctx context.Context) error
- type EventTriggerConfig
- type EventTriggerSubscription
- type ExternalStateMachineDefinition
- type FunctionHandler
- type FunctionJob
- type FunctionMessageHandler
- type FunctionTransitionHandler
- type HTTPHandler
- type HTTPHandlerAdapter
- type HTTPIntegrationConnector
- func (c *HTTPIntegrationConnector) Connect(ctx context.Context) error
- func (c *HTTPIntegrationConnector) Disconnect(ctx context.Context) error
- func (c *HTTPIntegrationConnector) Execute(ctx context.Context, action string, params map[string]interface{}) (map[string]interface{}, error)
- func (c *HTTPIntegrationConnector) GetName() string
- func (c *HTTPIntegrationConnector) IsConnected() bool
- func (c *HTTPIntegrationConnector) SetBasicAuth(username, password string)
- func (c *HTTPIntegrationConnector) SetBearerAuth(token string)
- func (c *HTTPIntegrationConnector) SetDefaultHeader(key, value string)
- func (c *HTTPIntegrationConnector) SetHeader(key, value string)
- func (c *HTTPIntegrationConnector) SetRateLimit(requestsPerMinute int)
- func (c *HTTPIntegrationConnector) SetTimeout(timeout time.Duration)
- type HTTPMiddleware
- type HTTPRouter
- type HTTPServer
- type HTTPTrigger
- type HTTPTriggerConfig
- type HTTPTriggerRoute
- type HealthCheck
- type HealthCheckResult
- type HealthChecker
- func (h *HealthChecker) HealthHandler() http.HandlerFunc
- func (h *HealthChecker) Init(app modular.Application) error
- func (h *HealthChecker) LiveHandler() http.HandlerFunc
- func (h *HealthChecker) Name() string
- func (h *HealthChecker) ProvidesServices() []modular.ServiceProvider
- func (h *HealthChecker) ReadyHandler() http.HandlerFunc
- func (h *HealthChecker) RegisterCheck(name string, check HealthCheck)
- func (h *HealthChecker) RequiresServices() []modular.ServiceDependency
- func (h *HealthChecker) SetStarted(started bool)
- type HealthHTTPHandler
- type InMemoryMessageBroker
- func (b *InMemoryMessageBroker) Consumer() MessageConsumer
- func (b *InMemoryMessageBroker) Init(app modular.Application) error
- func (b *InMemoryMessageBroker) Name() string
- func (b *InMemoryMessageBroker) Producer() MessageProducer
- func (b *InMemoryMessageBroker) ProvidesServices() []modular.ServiceProvider
- func (b *InMemoryMessageBroker) RequiresServices() []modular.ServiceDependency
- func (b *InMemoryMessageBroker) SendMessage(topic string, message []byte) error
- func (b *InMemoryMessageBroker) Start(ctx context.Context) error
- func (b *InMemoryMessageBroker) Stop(ctx context.Context) error
- func (b *InMemoryMessageBroker) Subscribe(topic string, handler MessageHandler) error
- type IntegrationConnector
- type IntegrationRegistry
- type JWTAuthModule
- func (j *JWTAuthModule) Authenticate(tokenStr string) (bool, map[string]interface{}, error)
- func (j *JWTAuthModule) Handle(w http.ResponseWriter, r *http.Request)
- func (j *JWTAuthModule) Init(app modular.Application) error
- func (j *JWTAuthModule) Name() string
- func (j *JWTAuthModule) ProvidesServices() []modular.ServiceProvider
- func (j *JWTAuthModule) RequiresServices() []modular.ServiceDependency
- func (j *JWTAuthModule) Start(ctx context.Context) error
- func (j *JWTAuthModule) Stop(ctx context.Context) error
- type Job
- type KafkaBroker
- func (b *KafkaBroker) Consumer() MessageConsumer
- func (b *KafkaBroker) Init(app modular.Application) error
- func (b *KafkaBroker) Name() string
- func (b *KafkaBroker) Producer() MessageProducer
- func (b *KafkaBroker) ProvidesServices() []modular.ServiceProvider
- func (b *KafkaBroker) RequiresServices() []modular.ServiceDependency
- func (b *KafkaBroker) SetBrokers(brokers []string)
- func (b *KafkaBroker) SetGroupID(groupID string)
- func (b *KafkaBroker) Start(ctx context.Context) error
- func (b *KafkaBroker) Stop(_ context.Context) error
- func (b *KafkaBroker) Subscribe(topic string, handler MessageHandler) error
- type ListenerAdapter
- type LoggingMiddleware
- func (m *LoggingMiddleware) Init(app modular.Application) error
- func (m *LoggingMiddleware) Name() string
- func (m *LoggingMiddleware) Process(next http.Handler) http.Handler
- func (m *LoggingMiddleware) ProvidesServices() []modular.ServiceProvider
- func (m *LoggingMiddleware) RequiresServices() []modular.ServiceDependency
- type MessageBroker
- type MessageConsumer
- type MessageHandler
- type MessageHandlerAdapter
- type MessageHandlerJobAdapter
- type MessageProducer
- type MetricsCollector
- func (m *MetricsCollector) Handler() http.Handler
- func (m *MetricsCollector) Init(app modular.Application) error
- func (m *MetricsCollector) Name() string
- func (m *MetricsCollector) ProvidesServices() []modular.ServiceProvider
- func (m *MetricsCollector) RecordHTTPRequest(method, path string, statusCode int, duration time.Duration)
- func (m *MetricsCollector) RecordModuleOperation(module, operation, status string)
- func (m *MetricsCollector) RecordWorkflowDuration(workflowType, action string, duration time.Duration)
- func (m *MetricsCollector) RecordWorkflowExecution(workflowType, action, status string)
- func (m *MetricsCollector) RequiresServices() []modular.ServiceDependency
- func (m *MetricsCollector) SetActiveWorkflows(workflowType string, count float64)
- type MockApplication
- func (a *MockApplication) ConfigProvider() modular.ConfigProvider
- func (a *MockApplication) ConfigSections() map[string]modular.ConfigProvider
- func (a *MockApplication) GetAllModules() map[string]modular.Module
- func (a *MockApplication) GetConfig() map[string]interface{}
- func (a *MockApplication) GetConfigSection(section string) (modular.ConfigProvider, error)
- func (a *MockApplication) GetModule(name string) modular.Module
- func (a *MockApplication) GetService(name string, out interface{}) error
- func (a *MockApplication) GetServiceEntry(serviceName string) (*modular.ServiceRegistryEntry, bool)
- func (a *MockApplication) GetServicesByInterface(interfaceType reflect.Type) []*modular.ServiceRegistryEntry
- func (a *MockApplication) GetServicesByModule(moduleName string) []string
- func (a *MockApplication) Init() error
- func (a *MockApplication) IsVerboseConfig() bool
- func (a *MockApplication) Logger() modular.Logger
- func (a *MockApplication) OnConfigLoaded(hook func(modular.Application) error)
- func (a *MockApplication) RegisterConfigSection(name string, config modular.ConfigProvider)
- func (a *MockApplication) RegisterModule(module modular.Module)
- func (a *MockApplication) RegisterService(name string, service interface{}) error
- func (a *MockApplication) Run() error
- func (a *MockApplication) SetLogger(logger modular.Logger)
- func (a *MockApplication) SetVerboseConfig(enabled bool)
- func (a *MockApplication) Start() error
- func (a *MockApplication) StartTime() time.Time
- func (a *MockApplication) Stop() error
- func (a *MockApplication) SvcRegistry() modular.ServiceRegistry
- type MockConfigProvider
- type MockLogger
- func (l *MockLogger) Debug(format string, args ...interface{})
- func (l *MockLogger) Error(format string, args ...interface{})
- func (l *MockLogger) Fatal(format string, args ...interface{})
- func (l *MockLogger) Info(format string, args ...interface{})
- func (l *MockLogger) Warn(format string, args ...interface{})
- type MockScheduler
- func (s *MockScheduler) Init(registry modular.ServiceRegistry) error
- func (s *MockScheduler) Name() string
- func (s *MockScheduler) Schedule(job Job) error
- func (s *MockScheduler) SetCronExpression(index int, cronExpression string)
- func (s *MockScheduler) Start(ctx context.Context) error
- func (s *MockScheduler) Stop(ctx context.Context) error
- type MockWorkflowEngine
- type ModuleNamespace
- type ModuleNamespaceProvider
- type ModuleNamespaceProviderFunc
- func (m ModuleNamespaceProviderFunc) FormatName(baseName string) string
- func (m ModuleNamespaceProviderFunc) ResolveDependency(dependencyName string) string
- func (m ModuleNamespaceProviderFunc) ResolveServiceName(serviceName string) string
- func (m ModuleNamespaceProviderFunc) ValidateModuleName(moduleName string) error
- type NATSBroker
- func (b *NATSBroker) Consumer() MessageConsumer
- func (b *NATSBroker) Init(app modular.Application) error
- func (b *NATSBroker) Name() string
- func (b *NATSBroker) Producer() MessageProducer
- func (b *NATSBroker) ProvidesServices() []modular.ServiceProvider
- func (b *NATSBroker) RequiresServices() []modular.ServiceDependency
- func (b *NATSBroker) SetURL(url string)
- func (b *NATSBroker) Start(ctx context.Context) error
- func (b *NATSBroker) Stop(_ context.Context) error
- func (b *NATSBroker) Subscribe(topic string, handler MessageHandler) error
- type OTelTracing
- func (o *OTelTracing) Init(app modular.Application) error
- func (o *OTelTracing) Name() string
- func (o *OTelTracing) ProvidesServices() []modular.ServiceProvider
- func (o *OTelTracing) RequiresServices() []modular.ServiceDependency
- func (o *OTelTracing) SetEndpoint(endpoint string)
- func (o *OTelTracing) SetServiceName(serviceName string)
- func (o *OTelTracing) Start(ctx context.Context) error
- func (o *OTelTracing) Stop(ctx context.Context) error
- type PatternMatch
- type QueryResult
- type RESTAPIHandler
- func (h *RESTAPIHandler) Constructor() modular.ModuleConstructor
- func (h *RESTAPIHandler) Handle(w http.ResponseWriter, r *http.Request)
- func (h *RESTAPIHandler) Init(app modular.Application) error
- func (h *RESTAPIHandler) Name() string
- func (h *RESTAPIHandler) ProvidesServices() []modular.ServiceProvider
- func (h *RESTAPIHandler) RequiresServices() []modular.ServiceDependency
- func (h *RESTAPIHandler) SetSeedFile(path string)
- func (h *RESTAPIHandler) SetWorkflowEngine(we string)
- func (h *RESTAPIHandler) SetWorkflowType(wt string)
- func (h *RESTAPIHandler) Start(ctx context.Context) error
- func (h *RESTAPIHandler) Stop(ctx context.Context) error
- type RESTAPIHandlerConfig
- type RESTResource
- type RateLimitMiddleware
- func (m *RateLimitMiddleware) Init(app modular.Application) error
- func (m *RateLimitMiddleware) Name() string
- func (m *RateLimitMiddleware) Process(next http.Handler) http.Handler
- func (m *RateLimitMiddleware) ProvidesServices() []modular.ServiceProvider
- func (m *RateLimitMiddleware) RequiresServices() []modular.ServiceDependency
- func (m *RateLimitMiddleware) Start(ctx context.Context) error
- func (m *RateLimitMiddleware) Stop(ctx context.Context) error
- type RequestIDMiddleware
- func (m *RequestIDMiddleware) Init(app modular.Application) error
- func (m *RequestIDMiddleware) Middleware() func(http.Handler) http.Handler
- func (m *RequestIDMiddleware) Name() string
- func (m *RequestIDMiddleware) Process(next http.Handler) http.Handler
- func (m *RequestIDMiddleware) ProvidesServices() []modular.ServiceProvider
- func (m *RequestIDMiddleware) RequiresServices() []modular.ServiceDependency
- type ResourceStateMapping
- type Route
- type S3Storage
- func (s *S3Storage) DeleteObject(ctx context.Context, key string) error
- func (s *S3Storage) GetObject(ctx context.Context, key string) (io.ReadCloser, error)
- func (s *S3Storage) Init(app modular.Application) error
- func (s *S3Storage) Name() string
- func (s *S3Storage) ProvidesServices() []modular.ServiceProvider
- func (s *S3Storage) PutObject(ctx context.Context, key string, body io.Reader) error
- func (s *S3Storage) RequiresServices() []modular.ServiceDependency
- func (s *S3Storage) SetBucket(bucket string)
- func (s *S3Storage) SetClient(client *s3.Client)
- func (s *S3Storage) SetEndpoint(endpoint string)
- func (s *S3Storage) SetRegion(region string)
- func (s *S3Storage) Start(ctx context.Context) error
- func (s *S3Storage) Stop(_ context.Context) error
- type ScheduleTrigger
- func (t *ScheduleTrigger) Configure(app modular.Application, triggerConfig interface{}) error
- func (t *ScheduleTrigger) Init(app modular.Application) error
- func (t *ScheduleTrigger) Name() string
- func (t *ScheduleTrigger) Start(ctx context.Context) error
- func (t *ScheduleTrigger) Stop(ctx context.Context) error
- type ScheduleTriggerConfig
- type ScheduleTriggerJob
- type ScheduledJobInfo
- type Scheduler
- type ServiceRegistry
- type SimpleHTTPHandler
- func (h *SimpleHTTPHandler) Handle(w http.ResponseWriter, r *http.Request)
- func (h *SimpleHTTPHandler) Init(app modular.Application) error
- func (h *SimpleHTTPHandler) Name() string
- func (h *SimpleHTTPHandler) ProvidesServices() []modular.ServiceProvider
- func (h *SimpleHTTPHandler) RequiresServices() []modular.ServiceDependency
- func (h *SimpleHTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (h *SimpleHTTPHandler) SetHandleFunc(fn func(w http.ResponseWriter, r *http.Request))
- type SimpleMessageHandler
- func (h *SimpleMessageHandler) Constructor() modular.ModuleConstructor
- func (h *SimpleMessageHandler) Dependencies() []string
- func (h *SimpleMessageHandler) HandleMessage(message []byte) error
- func (h *SimpleMessageHandler) Init(app modular.Application) error
- func (h *SimpleMessageHandler) Name() string
- func (h *SimpleMessageHandler) ProvidesServices() []modular.ServiceProvider
- func (h *SimpleMessageHandler) RequiresServices() []modular.ServiceDependency
- func (h *SimpleMessageHandler) SetBrokerDependencies(brokerNames []string)
- func (h *SimpleMessageHandler) SetHandleFunc(fn func(message []byte) error)
- func (h *SimpleMessageHandler) SetProducer(producer MessageProducer)
- func (h *SimpleMessageHandler) SetTargetTopics(topics []string)
- func (h *SimpleMessageHandler) Start(ctx context.Context) error
- func (h *SimpleMessageHandler) Stop(ctx context.Context) error
- type SimpleTokenProvider
- type SlackNotification
- func (s *SlackNotification) HandleMessage(message []byte) error
- func (s *SlackNotification) Init(app modular.Application) error
- func (s *SlackNotification) Name() string
- func (s *SlackNotification) ProvidesServices() []modular.ServiceProvider
- func (s *SlackNotification) RequiresServices() []modular.ServiceDependency
- func (s *SlackNotification) SetChannel(channel string)
- func (s *SlackNotification) SetClient(client *http.Client)
- func (s *SlackNotification) SetUsername(username string)
- func (s *SlackNotification) SetWebhookURL(url string)
- type StandardHTTPHandler
- type StandardHTTPRouter
- func (r *StandardHTTPRouter) AddRoute(method, path string, handler HTTPHandler)
- func (r *StandardHTTPRouter) AddRouteWithMiddleware(method, path string, handler HTTPHandler, middlewares []HTTPMiddleware)
- func (r *StandardHTTPRouter) Constructor() modular.ModuleConstructor
- func (r *StandardHTTPRouter) Dependencies() []string
- func (r *StandardHTTPRouter) HasRoute(method, path string) bool
- func (r *StandardHTTPRouter) Init(app modular.Application) error
- func (r *StandardHTTPRouter) Name() string
- func (r *StandardHTTPRouter) ProvidesServices() []modular.ServiceProvider
- func (r *StandardHTTPRouter) RequiresServices() []modular.ServiceDependency
- func (r *StandardHTTPRouter) ServeHTTP(w http.ResponseWriter, req *http.Request)
- func (r *StandardHTTPRouter) SetServerDependencies(serverNames []string)
- func (r *StandardHTTPRouter) Start(ctx context.Context) error
- func (r *StandardHTTPRouter) Stop(ctx context.Context) error
- type StandardHTTPServer
- func (s *StandardHTTPServer) AddRouter(router HTTPRouter)
- func (s *StandardHTTPServer) Init(app modular.Application) error
- func (s *StandardHTTPServer) Name() string
- func (s *StandardHTTPServer) ProvidesServices() []modular.ServiceProvider
- func (s *StandardHTTPServer) RequiresServices() []modular.ServiceDependency
- func (s *StandardHTTPServer) Start(ctx context.Context) error
- func (s *StandardHTTPServer) Stop(ctx context.Context) error
- type StandardNamespace
- type State
- type StateChangeListener
- type StateInfo
- type StateMachineDefinition
- type StateMachineEngine
- func (e *StateMachineEngine) AddGlobalTransitionHandler(handler TransitionHandler)
- func (e *StateMachineEngine) AddTransitionListener(listener TransitionListener)
- func (e *StateMachineEngine) CreateWorkflow(workflowType string, id string, initialData map[string]interface{}) (*WorkflowInstance, error)
- func (e *StateMachineEngine) GetAllInstances() ([]*WorkflowInstance, error)
- func (e *StateMachineEngine) GetInstance(id string) (*WorkflowInstance, error)
- func (e *StateMachineEngine) GetInstancesByType(workflowType string) ([]*WorkflowInstance, error)
- func (e *StateMachineEngine) GetTransitionHandler() TransitionHandler
- func (e *StateMachineEngine) HasTransitionHandler() bool
- func (e *StateMachineEngine) Init(app modular.Application) error
- func (e *StateMachineEngine) Name() string
- func (e *StateMachineEngine) ProvidesServices() []modular.ServiceProvider
- func (e *StateMachineEngine) RegisterDefinition(def *StateMachineDefinition) error
- func (e *StateMachineEngine) RegisterWorkflow(def ExternalStateMachineDefinition) error
- func (e *StateMachineEngine) RequiresServices() []modular.ServiceDependency
- func (e *StateMachineEngine) SetTransitionHandler(handler TransitionHandler)
- func (e *StateMachineEngine) Start(ctx context.Context) error
- func (e *StateMachineEngine) Stop(ctx context.Context) error
- func (e *StateMachineEngine) TriggerTransition(ctx context.Context, workflowID string, transitionName string, ...) error
- type StateMachineStateConfig
- type StateMachineStateConnector
- func (c *StateMachineStateConnector) Configure(mappings []ResourceStateMapping) error
- func (c *StateMachineStateConnector) GetEngineForResourceType(resourceType string) (string, bool)
- func (c *StateMachineStateConnector) GetResourceState(resourceType, resourceID string) (string, map[string]interface{}, error)
- func (c *StateMachineStateConnector) Init(app modular.Application) error
- func (c *StateMachineStateConnector) Name() string
- func (c *StateMachineStateConnector) ProvidesServices() []modular.ServiceProvider
- func (c *StateMachineStateConnector) RegisterMapping(resourceType, stateMachine, instanceIDKey string)
- func (c *StateMachineStateConnector) RequiresServices() []modular.ServiceDependency
- func (c *StateMachineStateConnector) Start(ctx context.Context) error
- func (c *StateMachineStateConnector) Stop(ctx context.Context) error
- func (c *StateMachineStateConnector) UpdateResourceState(resourceType, resourceID string) error
- type StateMachineTransitionConfig
- type StateTracker
- func (s *StateTracker) AddStateChangeListener(resourceType string, listener StateChangeListener)
- func (s *StateTracker) GetState(resourceType, resourceID string) (StateInfo, bool)
- func (s *StateTracker) Init(app modular.Application) error
- func (s *StateTracker) Name() string
- func (s *StateTracker) ProvidesServices() []modular.ServiceProvider
- func (s *StateTracker) RequiresServices() []modular.ServiceDependency
- func (s *StateTracker) SetState(resourceType, resourceID, state string, data map[string]interface{})
- func (s *StateTracker) Start(ctx context.Context) error
- func (s *StateTracker) Stop(ctx context.Context) error
- type StaticFileServer
- func (s *StaticFileServer) Handle(w http.ResponseWriter, r *http.Request)
- func (s *StaticFileServer) Init(app modular.Application) error
- func (s *StaticFileServer) Name() string
- func (s *StaticFileServer) Prefix() string
- func (s *StaticFileServer) ProvidesServices() []modular.ServiceProvider
- func (s *StaticFileServer) RequiresServices() []modular.ServiceDependency
- func (s *StaticFileServer) Start(ctx context.Context) error
- func (s *StaticFileServer) Stop(ctx context.Context) error
- type StdIntegrationRegistry
- func (r *StdIntegrationRegistry) GetConnector(name string) (IntegrationConnector, error)
- func (r *StdIntegrationRegistry) Init(app modular.Application) error
- func (r *StdIntegrationRegistry) ListConnectors() []string
- func (r *StdIntegrationRegistry) Name() string
- func (r *StdIntegrationRegistry) RegisterConnector(connector IntegrationConnector)
- func (r *StdIntegrationRegistry) Start() error
- func (r *StdIntegrationRegistry) Stop() error
- type StepLifecycleEvent
- type TestHelper
- type TestLogger
- type TransformOperation
- type TransformPipeline
- type Transition
- type TransitionEvent
- type TransitionHandler
- type TransitionListener
- type TransitionTrigger
- type Trigger
- type TriggerRegistry
- type TriggerWorkflower
- type User
- type ValidatingNamespace
- type WebhookConfig
- type WebhookDelivery
- type WebhookIntegrationConnector
- func (c *WebhookIntegrationConnector) Connect(ctx context.Context) error
- func (c *WebhookIntegrationConnector) Disconnect(ctx context.Context) error
- func (c *WebhookIntegrationConnector) Execute(ctx context.Context, action string, params map[string]interface{}) (map[string]interface{}, error)
- func (c *WebhookIntegrationConnector) GetName() string
- func (c *WebhookIntegrationConnector) IsConnected() bool
- func (c *WebhookIntegrationConnector) RegisterEventHandler(eventType string, handler func(context.Context, map[string]interface{}) error)
- type WebhookSender
- func (ws *WebhookSender) GetDeadLetters() []*WebhookDelivery
- func (ws *WebhookSender) Init(app modular.Application) error
- func (ws *WebhookSender) Name() string
- func (ws *WebhookSender) RetryDeadLetter(ctx context.Context, id string) (*WebhookDelivery, error)
- func (ws *WebhookSender) Send(ctx context.Context, url string, payload []byte, headers map[string]string) (*WebhookDelivery, error)
- func (ws *WebhookSender) SetClient(client *http.Client)
- type WorkflowDatabase
- func (w *WorkflowDatabase) Close() error
- func (w *WorkflowDatabase) DB() *sql.DB
- func (w *WorkflowDatabase) DeleteRows(ctx context.Context, table string, where string, whereArgs ...interface{}) (int64, error)
- func (w *WorkflowDatabase) Execute(ctx context.Context, sqlStr string, args ...interface{}) (int64, error)
- func (w *WorkflowDatabase) Init(app modular.Application) error
- func (w *WorkflowDatabase) InsertRow(ctx context.Context, table string, data map[string]interface{}) (int64, error)
- func (w *WorkflowDatabase) Name() string
- func (w *WorkflowDatabase) Open() (*sql.DB, error)
- func (w *WorkflowDatabase) Ping(ctx context.Context) error
- func (w *WorkflowDatabase) Query(ctx context.Context, sqlStr string, args ...interface{}) (*QueryResult, error)
- func (w *WorkflowDatabase) UpdateRows(ctx context.Context, table string, data map[string]interface{}, where string, ...) (int64, error)
- type WorkflowEngine
- type WorkflowEventEmitter
- func (e *WorkflowEventEmitter) EmitStepCompleted(ctx context.Context, workflowType, stepName, connector, action string, ...)
- func (e *WorkflowEventEmitter) EmitStepFailed(ctx context.Context, workflowType, stepName, connector, action string, ...)
- func (e *WorkflowEventEmitter) EmitStepStarted(ctx context.Context, workflowType, stepName, connector, action string)
- func (e *WorkflowEventEmitter) EmitWorkflowCompleted(ctx context.Context, workflowType, action string, duration time.Duration, ...)
- func (e *WorkflowEventEmitter) EmitWorkflowFailed(ctx context.Context, workflowType, action string, duration time.Duration, ...)
- func (e *WorkflowEventEmitter) EmitWorkflowStarted(ctx context.Context, workflowType, action string, data map[string]interface{})
- type WorkflowInstance
- type WorkflowLifecycleEvent
- type WorkflowTriggerInfo
- type WorkflowUIHandler
Constants ¶
const ( LifecycleStarted = "started" LifecycleCompleted = "completed" LifecycleFailed = "failed" )
Lifecycle constants for workflow and step events.
const EventBusBridgeName = "messaging.broker.eventbus"
EventBusBridgeName is the default service name for the EventBus bridge adapter.
const (
// EventBusTriggerName is the standard name for the EventBus trigger.
EventBusTriggerName = "trigger.eventbus"
)
const (
// EventTriggerName is the standard name for event triggers
EventTriggerName = "trigger.event"
)
const (
// HTTPTriggerName is the standard name for HTTP triggers
HTTPTriggerName = "trigger.http"
)
const (
InMemoryMessageBrokerName = "messaging.broker.memory"
)
Standard module name constants
const (
// ScheduleTriggerName is the standard name for schedule triggers
ScheduleTriggerName = "trigger.schedule"
)
const (
SimpleMessageHandlerName = "messaging.handler"
)
Standard module name constants
const (
StateMachineEngineName = "statemachine.engine"
)
Standard module name constants
const StateMachineStateConnectorName = "workflow.connector.statemachine"
StateMachineStateConnectorName is the standard service name
const StateTrackerName = "workflow.service.statetracker"
StateTrackerName is the standard name for the state tracker service
Variables ¶
This section is empty.
Functions ¶
func BuildDeleteSQL ¶
BuildDeleteSQL builds a DELETE SQL string (exported for testing)
func BuildInsertSQL ¶
BuildInsertSQL builds an INSERT SQL string and returns it with values (exported for testing)
func BuildUpdateSQL ¶
func BuildUpdateSQL(table string, data map[string]interface{}, where string, whereArgs ...interface{}) (string, []interface{})
BuildUpdateSQL builds an UPDATE SQL string and returns it with values (exported for testing)
func CalculateBackoff ¶
func CalculateBackoff(initialBackoff time.Duration, multiplier float64, maxBackoff time.Duration, attempt int) time.Duration
CalculateBackoff is exported for testing
func CreateIsolatedApp ¶
func CreateIsolatedApp(t *testing.T) modular.Application
CreateIsolatedApp creates an isolated application for tests
func GetRequestID ¶
GetRequestID extracts the request ID from the context.
func SkipTestWithContext ¶
Skip tests with a context.Context parameter
func StepTopic ¶
StepTopic returns the event bus topic for a step lifecycle event. Format: "workflow.<workflowType>.step.<stepName>.<lifecycle>"
func WorkflowTopic ¶
WorkflowTopic returns the event bus topic for a workflow lifecycle event. Format: "workflow.<workflowType>.<lifecycle>"
Types ¶
type AuthMiddleware ¶
type AuthMiddleware struct {
// contains filtered or unexported fields
}
AuthMiddleware implements an HTTP authorization middleware
func NewAuthMiddleware ¶
func NewAuthMiddleware(name string, authType string) *AuthMiddleware
NewAuthMiddleware creates a new authentication middleware
func (*AuthMiddleware) AddProvider ¶
func (m *AuthMiddleware) AddProvider(validTokens map[string]map[string]interface{})
AddProvider creates and registers a simple token-based auth provider
func (*AuthMiddleware) Init ¶
func (m *AuthMiddleware) Init(app modular.Application) error
Init initializes the middleware with the application context
func (*AuthMiddleware) Process ¶
func (m *AuthMiddleware) Process(next http.Handler) http.Handler
Process implements the HTTPMiddleware interface
func (*AuthMiddleware) ProvidesServices ¶
func (m *AuthMiddleware) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns the services provided by this module
func (*AuthMiddleware) RegisterProvider ¶
func (m *AuthMiddleware) RegisterProvider(provider AuthProvider)
RegisterProvider adds an authentication provider
func (*AuthMiddleware) RequiresServices ¶
func (m *AuthMiddleware) RequiresServices() []modular.ServiceDependency
RequiresServices returns services required by this module
type AuthProvider ¶
AuthProvider defines methods for authentication providers
type CORSMiddleware ¶
type CORSMiddleware struct {
// contains filtered or unexported fields
}
CORSMiddleware provides CORS support
func NewCORSMiddleware ¶
func NewCORSMiddleware(name string, allowedOrigins, allowedMethods []string) *CORSMiddleware
NewCORSMiddleware creates a new CORS middleware
func (*CORSMiddleware) Init ¶
func (m *CORSMiddleware) Init(app modular.Application) error
Init initializes the middleware
func (*CORSMiddleware) Process ¶
func (m *CORSMiddleware) Process(next http.Handler) http.Handler
Process implements middleware processing
func (*CORSMiddleware) ProvidesServices ¶
func (m *CORSMiddleware) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns the services provided by this middleware
func (*CORSMiddleware) RequiresServices ¶
func (m *CORSMiddleware) RequiresServices() []modular.ServiceDependency
RequiresServices returns services required by this middleware
type CompositeTransitionHandler ¶
type CompositeTransitionHandler struct {
// contains filtered or unexported fields
}
CompositeTransitionHandler combines multiple transition handlers
func NewCompositeTransitionHandler ¶
func NewCompositeTransitionHandler() *CompositeTransitionHandler
NewCompositeTransitionHandler creates a new composite handler
func (*CompositeTransitionHandler) AddHandler ¶
func (c *CompositeTransitionHandler) AddHandler(handler TransitionHandler)
AddHandler adds a handler to the composite
func (*CompositeTransitionHandler) HandleTransition ¶
func (c *CompositeTransitionHandler) HandleTransition(ctx context.Context, event TransitionEvent) error
HandleTransition calls all handlers in sequence
type CronScheduler ¶
type CronScheduler struct {
// contains filtered or unexported fields
}
CronScheduler implements a cron-based scheduler
func NewCronScheduler ¶
func NewCronScheduler(name string, cronExpression string) *CronScheduler
NewCronScheduler creates a new cron scheduler
func (*CronScheduler) Init ¶
func (s *CronScheduler) Init(app modular.Application) error
Init initializes the scheduler
func (*CronScheduler) Schedule ¶
func (s *CronScheduler) Schedule(job Job) error
Schedule adds a job to the scheduler
type CrossWorkflowRouter ¶
type CrossWorkflowRouter struct {
// contains filtered or unexported fields
}
CrossWorkflowRouter routes events from one workflow to linked target workflows.
func NewCrossWorkflowRouter ¶
func NewCrossWorkflowRouter(linkStore store.CrossWorkflowLinkStore, getEngine func(uuid.UUID) (interface{}, bool), logger *slog.Logger) *CrossWorkflowRouter
NewCrossWorkflowRouter creates a new router. The getEngine callback must return a value whose concrete type has a field or method that provides a TriggerWorkflower. In practice this is *workflow.ManagedEngine.
func (*CrossWorkflowRouter) RefreshLinks ¶
func (r *CrossWorkflowRouter) RefreshLinks(ctx context.Context) error
RefreshLinks reloads link configurations from the database.
func (*CrossWorkflowRouter) RouteEvent ¶
func (r *CrossWorkflowRouter) RouteEvent(ctx context.Context, sourceWorkflowID uuid.UUID, eventType string, eventData interface{}) error
RouteEvent checks if an event from a source workflow should be forwarded to any target workflows based on configured links.
type DataTransformer ¶
type DataTransformer struct {
// contains filtered or unexported fields
}
DataTransformer provides named data transformation pipelines
func NewDataTransformer ¶
func NewDataTransformer(name string) *DataTransformer
NewDataTransformer creates a new DataTransformer module
func (*DataTransformer) Init ¶
func (dt *DataTransformer) Init(app modular.Application) error
Init registers the data transformer as a service
func (*DataTransformer) Name ¶
func (dt *DataTransformer) Name() string
Name returns the module name
func (*DataTransformer) RegisterPipeline ¶
func (dt *DataTransformer) RegisterPipeline(pipeline *TransformPipeline)
RegisterPipeline registers a named transformation pipeline
func (*DataTransformer) Transform ¶
func (dt *DataTransformer) Transform(ctx context.Context, pipelineName string, data interface{}) (interface{}, error)
Transform runs a named pipeline on the given data
func (*DataTransformer) TransformWithOps ¶
func (dt *DataTransformer) TransformWithOps(ctx context.Context, ops []TransformOperation, data interface{}) (interface{}, error)
TransformWithOps runs a sequence of operations on the given data
type DatabaseConfig ¶
type DatabaseConfig struct {
Driver string `json:"driver" yaml:"driver"`
DSN string `json:"dsn" yaml:"dsn"`
MaxOpenConns int `json:"maxOpenConns" yaml:"maxOpenConns"`
MaxIdleConns int `json:"maxIdleConns" yaml:"maxIdleConns"`
ConnMaxLifetime time.Duration `json:"connMaxLifetime" yaml:"connMaxLifetime"`
MigrationsDir string `json:"migrationsDir" yaml:"migrationsDir"`
}
DatabaseConfig holds configuration for the workflow database module
type DatabaseIntegrationConnector ¶
type DatabaseIntegrationConnector struct {
// contains filtered or unexported fields
}
DatabaseIntegrationConnector implements IntegrationConnector for database operations
func NewDatabaseIntegrationConnector ¶
func NewDatabaseIntegrationConnector(name string, db *WorkflowDatabase) *DatabaseIntegrationConnector
NewDatabaseIntegrationConnector creates a new database integration connector
func (*DatabaseIntegrationConnector) Connect ¶
func (c *DatabaseIntegrationConnector) Connect(ctx context.Context) error
Connect opens the database connection
func (*DatabaseIntegrationConnector) Disconnect ¶
func (c *DatabaseIntegrationConnector) Disconnect(ctx context.Context) error
Disconnect closes the database connection
func (*DatabaseIntegrationConnector) Execute ¶
func (c *DatabaseIntegrationConnector) Execute(ctx context.Context, action string, params map[string]interface{}) (map[string]interface{}, error)
Execute dispatches to the appropriate WorkflowDatabase method based on action
func (*DatabaseIntegrationConnector) GetName ¶
func (c *DatabaseIntegrationConnector) GetName() string
GetName returns the connector name
func (*DatabaseIntegrationConnector) IsConnected ¶
func (c *DatabaseIntegrationConnector) IsConnected() bool
IsConnected returns whether the connector is connected
type EventBusBridge ¶
type EventBusBridge struct {
// contains filtered or unexported fields
}
EventBusBridge adapts the modular framework's EventBusModule to the workflow engine's MessageBroker interface. It allows the workflow engine to publish and subscribe to events through the EventBus using the existing MessageBroker API.
func NewEventBusBridge ¶
func NewEventBusBridge(name string) *EventBusBridge
NewEventBusBridge creates a new EventBusBridge with the given name.
func (*EventBusBridge) Consumer ¶
func (b *EventBusBridge) Consumer() MessageConsumer
Consumer returns the bridge itself, which implements MessageConsumer.
func (*EventBusBridge) Init ¶
func (b *EventBusBridge) Init(app modular.Application) error
Init registers the bridge as a service in the application's service registry. It does not look up the EventBus here; that is done via SetEventBus or InitFromApp after the application has been fully initialized.
func (*EventBusBridge) InitFromApp ¶
func (b *EventBusBridge) InitFromApp(app modular.Application) error
InitFromApp looks up the EventBusModule from the application's service registry using the well-known service name "eventbus.provider".
func (*EventBusBridge) Name ¶
func (b *EventBusBridge) Name() string
Name returns the bridge's service name.
func (*EventBusBridge) Producer ¶
func (b *EventBusBridge) Producer() MessageProducer
Producer returns the bridge itself, which implements MessageProducer.
func (*EventBusBridge) SendMessage ¶
func (b *EventBusBridge) SendMessage(topic string, message []byte) error
SendMessage publishes a message to the EventBus. The message bytes are unmarshalled from JSON into an interface{} payload. If unmarshalling fails, the raw bytes are published as the payload. Returns nil (no-op) if no EventBus has been set.
func (*EventBusBridge) SetEventBus ¶
func (b *EventBusBridge) SetEventBus(eb *eventbus.EventBusModule)
SetEventBus injects the EventBusModule directly. This is useful when the engine already has a reference to the EventBus after app.Init().
func (*EventBusBridge) Start ¶
func (b *EventBusBridge) Start(_ context.Context) error
Start is a no-op; the EventBus lifecycle is managed externally.
func (*EventBusBridge) Stop ¶
func (b *EventBusBridge) Stop(_ context.Context) error
Stop cancels all active subscriptions and clears the subscription map.
func (*EventBusBridge) Subscribe ¶
func (b *EventBusBridge) Subscribe(topic string, handler MessageHandler) error
Subscribe registers a MessageHandler to receive events from the EventBus on the given topic. Events are marshalled to JSON before being passed to the handler. Returns nil (no-op) if no EventBus has been set.
func (*EventBusBridge) Unsubscribe ¶
func (b *EventBusBridge) Unsubscribe(topic string) error
Unsubscribe cancels the subscription for the given topic and removes it.
type EventBusTrigger ¶
type EventBusTrigger struct {
// contains filtered or unexported fields
}
EventBusTrigger implements the Trigger interface and starts workflows in response to events published on the EventBus.
func NewEventBusTrigger ¶
func NewEventBusTrigger() *EventBusTrigger
NewEventBusTrigger creates a new EventBus trigger with default namespace.
func NewEventBusTriggerWithNamespace ¶
func NewEventBusTriggerWithNamespace(namespace ModuleNamespaceProvider) *EventBusTrigger
NewEventBusTriggerWithNamespace creates a new EventBus trigger with namespace support.
func (*EventBusTrigger) Configure ¶
func (t *EventBusTrigger) Configure(app modular.Application, triggerConfig interface{}) error
Configure parses the trigger config and resolves the EventBus and engine services from the application.
func (*EventBusTrigger) Init ¶
func (t *EventBusTrigger) Init(app modular.Application) error
Init registers the trigger as a service.
func (*EventBusTrigger) Name ¶
func (t *EventBusTrigger) Name() string
Name returns the trigger name.
func (*EventBusTrigger) SetEventBusAndEngine ¶
func (t *EventBusTrigger) SetEventBusAndEngine(eb *eventbus.EventBusModule, engine WorkflowEngine)
SetEventBusAndEngine allows directly setting the EventBus and engine for testing.
type EventBusTriggerSubscription ¶
type EventBusTriggerSubscription struct {
Topic string `json:"topic" yaml:"topic"`
Event string `json:"event,omitempty" yaml:"event,omitempty"`
Workflow string `json:"workflow" yaml:"workflow"`
Action string `json:"action" yaml:"action"`
Async bool `json:"async,omitempty" yaml:"async,omitempty"`
Params map[string]interface{} `json:"params,omitempty" yaml:"params,omitempty"`
}
EventBusTriggerSubscription defines a single subscription that the trigger listens to on the EventBus and maps to a workflow execution.
type EventData ¶
type EventData struct {
EventType string `json:"eventType"`
Timestamp time.Time `json:"timestamp"`
SourceID string `json:"sourceId"`
CorrelID string `json:"correlId,omitempty"`
Data map[string]interface{} `json:"data,omitempty"`
RawMessage []byte `json:"-"`
}
EventData represents an event in the system
type EventHandler ¶
type EventHandler interface {
HandlePattern(ctx context.Context, match PatternMatch) error
}
EventHandler processes matched event patterns
type EventPattern ¶
type EventPattern struct {
PatternID string `json:"patternId" yaml:"patternId"`
EventTypes []string `json:"eventTypes" yaml:"eventTypes"`
WindowTime time.Duration `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]interface{} `json:"extraParams,omitempty" yaml:"extraParams,omitempty"`
}
EventPattern defines a pattern for matching complex event sequences
type EventProcessor ¶
type EventProcessor struct {
// contains filtered or unexported fields
}
EventProcessor processes complex event patterns
func GetProcessor ¶
func GetProcessor(app modular.Application) (*EventProcessor, error)
GetProcessor is a utility to get an event processor from the app
func NewEventProcessor ¶
func NewEventProcessor(name string) *EventProcessor
NewEventProcessor creates a new complex event processor
func (*EventProcessor) AddPattern ¶
func (p *EventProcessor) AddPattern(pattern *EventPattern)
AddPattern adds a new event pattern to monitor
func (*EventProcessor) Error ¶
func (p *EventProcessor) Error() string
Error returns the last error from the processor - implements the error interface
func (*EventProcessor) GetService ¶
func (p *EventProcessor) GetService(name string, out interface{}) error
GetService implements the service functionality expected by handlers. It follows the modular.Application interface signature
func (*EventProcessor) Init ¶
func (p *EventProcessor) Init(app modular.Application) error
Init initializes the event processor
func (*EventProcessor) ProcessEvent ¶
func (p *EventProcessor) ProcessEvent(ctx context.Context, event EventData) error
ProcessEvent processes a new event and checks for pattern matches
func (*EventProcessor) ProvidesServices ¶
func (p *EventProcessor) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns services provided by this processor
func (*EventProcessor) RegisterHandler ¶
func (p *EventProcessor) RegisterHandler(patternID string, handler EventHandler) error
RegisterHandler registers a handler for a specific pattern
func (*EventProcessor) RequiresServices ¶
func (p *EventProcessor) RequiresServices() []modular.ServiceDependency
RequiresServices returns services required by this processor
func (*EventProcessor) Service ¶
func (p *EventProcessor) Service(name string) interface{}
Service provides access to a named service
func (*EventProcessor) Services ¶
func (p *EventProcessor) Services() map[string]interface{}
Services returns a map of all available services
func (*EventProcessor) SetError ¶
func (p *EventProcessor) SetError(err error)
SetError sets the processor error
type EventProcessorLocator ¶
type EventProcessorLocator struct {
App modular.Application
}
EventProcessorLocator helps locate the event processor
func NewEventProcessorLocator ¶
func NewEventProcessorLocator(app modular.Application) *EventProcessorLocator
NewEventProcessorLocator creates a new locator
func (*EventProcessorLocator) Locate ¶
func (l *EventProcessorLocator) Locate(name string) (*EventProcessor, error)
Locate finds an event processor by name
func (*EventProcessorLocator) LocateDefault ¶
func (l *EventProcessorLocator) LocateDefault() (*EventProcessor, error)
LocateDefault finds the default event processor
type EventTrigger ¶
type EventTrigger struct {
// contains filtered or unexported fields
}
EventTrigger implements a trigger that starts workflows from messaging events
func NewEventTrigger ¶
func NewEventTrigger() *EventTrigger
NewEventTrigger creates a new event trigger
func NewEventTriggerWithNamespace ¶
func NewEventTriggerWithNamespace(namespace ModuleNamespaceProvider) *EventTrigger
NewEventTriggerWithNamespace creates a new event trigger with namespace support
func (*EventTrigger) Configure ¶
func (t *EventTrigger) Configure(app modular.Application, triggerConfig interface{}) error
Configure sets up the trigger from configuration
func (*EventTrigger) Init ¶
func (t *EventTrigger) Init(app modular.Application) error
Init initializes the trigger
func (*EventTrigger) Name ¶
func (t *EventTrigger) Name() string
Name returns the name of this trigger
func (*EventTrigger) SetBrokerAndEngine ¶
func (t *EventTrigger) SetBrokerAndEngine(broker MessageBroker, engine WorkflowEngine)
SetBrokerAndEngine allows directly setting the broker and engine for testing
type EventTriggerConfig ¶
type EventTriggerConfig struct {
Subscriptions []EventTriggerSubscription `json:"subscriptions" yaml:"subscriptions"`
}
EventTriggerConfig represents the configuration for an event trigger
type EventTriggerSubscription ¶
type EventTriggerSubscription struct {
Topic string `json:"topic" yaml:"topic"`
Event string `json:"event" yaml:"event"`
Workflow string `json:"workflow" yaml:"workflow"`
Action string `json:"action" yaml:"action"`
Params map[string]interface{} `json:"params,omitempty" yaml:"params,omitempty"`
}
EventTriggerSubscription represents a subscription to a message topic
type ExternalStateMachineDefinition ¶
type ExternalStateMachineDefinition struct {
ID string `json:"id" yaml:"id"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
InitialState string `json:"initialState" yaml:"initialState"`
States map[string]StateMachineStateConfig `json:"states" yaml:"states"`
Transitions map[string]StateMachineTransitionConfig `json:"transitions" yaml:"transitions"`
}
ExternalStateMachineDefinition is used for registering state machines from configuration
type FunctionHandler ¶
type FunctionHandler struct {
// contains filtered or unexported fields
}
FunctionHandler is a simple EventHandler that executes a function
func NewFunctionHandler ¶
func NewFunctionHandler(fn func(ctx context.Context, match PatternMatch) error) *FunctionHandler
NewFunctionHandler creates a new function-based event handler
func (*FunctionHandler) HandlePattern ¶
func (h *FunctionHandler) HandlePattern(ctx context.Context, match PatternMatch) error
HandlePattern handles a pattern match by calling the function
type FunctionJob ¶
type FunctionJob struct {
// contains filtered or unexported fields
}
FunctionJob is a Job implementation that executes a function
func NewFunctionJob ¶
func NewFunctionJob(fn func(context.Context) error) *FunctionJob
NewFunctionJob creates a new job from a function
type FunctionMessageHandler ¶
type FunctionMessageHandler struct {
// contains filtered or unexported fields
}
FunctionMessageHandler adapts a function to the MessageHandler interface
func NewFunctionMessageHandler ¶
func NewFunctionMessageHandler(fn func(message []byte) error) *FunctionMessageHandler
NewFunctionMessageHandler creates a new message handler from a function
func (*FunctionMessageHandler) HandleMessage ¶
func (h *FunctionMessageHandler) HandleMessage(message []byte) error
HandleMessage implements the MessageHandler interface
type FunctionTransitionHandler ¶
type FunctionTransitionHandler struct {
// contains filtered or unexported fields
}
FunctionTransitionHandler is a simple TransitionHandler that executes a function
func NewFunctionTransitionHandler ¶
func NewFunctionTransitionHandler(fn func(ctx context.Context, event TransitionEvent) error) *FunctionTransitionHandler
NewFunctionTransitionHandler creates a new function-based transition handler
func (*FunctionTransitionHandler) HandleTransition ¶
func (h *FunctionTransitionHandler) HandleTransition(ctx context.Context, event TransitionEvent) error
HandleTransition handles a state transition by calling the function
type HTTPHandler ¶
type HTTPHandler interface {
Handle(w http.ResponseWriter, r *http.Request)
}
HTTPHandler defines the interface for HTTP request handlers
type HTTPHandlerAdapter ¶
type HTTPHandlerAdapter struct {
// contains filtered or unexported fields
}
HTTPHandlerAdapter adapts an http.Handler to the HTTPHandler interface
func NewHTTPHandlerAdapter ¶
func NewHTTPHandlerAdapter(handler http.Handler) *HTTPHandlerAdapter
NewHTTPHandlerAdapter creates a new adapter for an http.Handler
func (*HTTPHandlerAdapter) Handle ¶
func (a *HTTPHandlerAdapter) Handle(w http.ResponseWriter, r *http.Request)
Handle implements the HTTPHandler interface
type HTTPIntegrationConnector ¶
type HTTPIntegrationConnector struct {
// contains filtered or unexported fields
}
HTTPIntegrationConnector implements a connector using HTTP requests
func NewHTTPIntegrationConnector ¶
func NewHTTPIntegrationConnector(name, baseURL string) *HTTPIntegrationConnector
NewHTTPIntegrationConnector creates a new HTTP-based integration connector
func (*HTTPIntegrationConnector) Connect ¶
func (c *HTTPIntegrationConnector) Connect(ctx context.Context) error
Connect establishes a connection to the external service
func (*HTTPIntegrationConnector) Disconnect ¶
func (c *HTTPIntegrationConnector) Disconnect(ctx context.Context) error
Disconnect closes the connection to the external service
func (*HTTPIntegrationConnector) Execute ¶
func (c *HTTPIntegrationConnector) Execute(ctx context.Context, action string, params map[string]interface{}) (map[string]interface{}, error)
Execute performs an action on the external service
func (*HTTPIntegrationConnector) GetName ¶
func (c *HTTPIntegrationConnector) GetName() string
GetName returns the connector name
func (*HTTPIntegrationConnector) IsConnected ¶
func (c *HTTPIntegrationConnector) IsConnected() bool
IsConnected checks if the connector is connected
func (*HTTPIntegrationConnector) SetBasicAuth ¶
func (c *HTTPIntegrationConnector) SetBasicAuth(username, password string)
SetBasicAuth sets basic authentication for the connector
func (*HTTPIntegrationConnector) SetBearerAuth ¶
func (c *HTTPIntegrationConnector) SetBearerAuth(token string)
SetBearerAuth sets bearer token authentication for the connector
func (*HTTPIntegrationConnector) SetDefaultHeader ¶
func (c *HTTPIntegrationConnector) SetDefaultHeader(key, value string)
SetDefaultHeader is an alias for SetHeader for backward compatibility
func (*HTTPIntegrationConnector) SetHeader ¶
func (c *HTTPIntegrationConnector) SetHeader(key, value string)
SetHeader sets a custom header for requests
func (*HTTPIntegrationConnector) SetRateLimit ¶
func (c *HTTPIntegrationConnector) SetRateLimit(requestsPerMinute int)
SetRateLimit sets a rate limit for requests
func (*HTTPIntegrationConnector) SetTimeout ¶
func (c *HTTPIntegrationConnector) SetTimeout(timeout time.Duration)
SetTimeout sets the request timeout
type HTTPMiddleware ¶
HTTPMiddleware defines a middleware that can process HTTP requests
type HTTPRouter ¶
type HTTPRouter interface {
AddRoute(method, path string, handler HTTPHandler)
}
HTTPRouter interface for routing HTTP requests
type HTTPServer ¶
type HTTPServer interface {
AddRouter(router HTTPRouter)
Start(ctx context.Context) error
Stop(ctx context.Context) error
}
HTTPServer interface for HTTP server modules
type HTTPTrigger ¶
type HTTPTrigger struct {
// contains filtered or unexported fields
}
HTTPTrigger implements a trigger that starts workflows from HTTP requests
func NewHTTPTriggerWithNamespace ¶
func NewHTTPTriggerWithNamespace(namespace ModuleNamespaceProvider) *HTTPTrigger
NewHTTPTriggerWithNamespace creates a new HTTP trigger with namespace support
func (*HTTPTrigger) Configure ¶
func (t *HTTPTrigger) Configure(app modular.Application, triggerConfig interface{}) error
Configure sets up the trigger from configuration
func (*HTTPTrigger) Init ¶
func (t *HTTPTrigger) Init(app modular.Application) error
Init initializes the trigger
func (*HTTPTrigger) Name ¶
func (t *HTTPTrigger) Name() string
Name returns the name of this trigger
type HTTPTriggerConfig ¶
type HTTPTriggerConfig struct {
Routes []HTTPTriggerRoute `json:"routes" yaml:"routes"`
}
HTTPTriggerConfig represents the configuration for an HTTP trigger
type HTTPTriggerRoute ¶
type HTTPTriggerRoute struct {
Path string `json:"path" yaml:"path"`
Method string `json:"method" yaml:"method"`
Workflow string `json:"workflow" yaml:"workflow"`
Action string `json:"action" yaml:"action"`
Params map[string]interface{} `json:"params,omitempty" yaml:"params,omitempty"`
}
HTTPTriggerRoute represents a single HTTP route configuration
type HealthCheck ¶
type HealthCheck func(ctx context.Context) HealthCheckResult
HealthCheck is a function that performs a health check.
type HealthCheckResult ¶
type HealthCheckResult struct {
Status string `json:"status"`
Message string `json:"message,omitempty"`
}
HealthCheckResult represents the result of a health check.
type HealthChecker ¶
type HealthChecker struct {
// contains filtered or unexported fields
}
HealthChecker provides /health, /ready, /live HTTP endpoints.
func NewHealthChecker ¶
func NewHealthChecker(name string) *HealthChecker
NewHealthChecker creates a new HealthChecker module.
func (*HealthChecker) HealthHandler ¶
func (h *HealthChecker) HealthHandler() http.HandlerFunc
HealthHandler returns an HTTP handler that runs all health checks.
func (*HealthChecker) Init ¶
func (h *HealthChecker) Init(app modular.Application) error
Init registers the health checker as a service.
func (*HealthChecker) LiveHandler ¶
func (h *HealthChecker) LiveHandler() http.HandlerFunc
LiveHandler returns an HTTP handler for liveness checks. Always returns 200 with {"status":"alive"}.
func (*HealthChecker) ProvidesServices ¶
func (h *HealthChecker) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns the services provided by this module.
func (*HealthChecker) ReadyHandler ¶
func (h *HealthChecker) ReadyHandler() http.HandlerFunc
ReadyHandler returns an HTTP handler that checks readiness. Returns 200 only if started AND all checks pass, else 503.
func (*HealthChecker) RegisterCheck ¶
func (h *HealthChecker) RegisterCheck(name string, check HealthCheck)
RegisterCheck adds a named health check function.
func (*HealthChecker) RequiresServices ¶
func (h *HealthChecker) RequiresServices() []modular.ServiceDependency
RequiresServices returns services required by this module.
func (*HealthChecker) SetStarted ¶
func (h *HealthChecker) SetStarted(started bool)
SetStarted marks the health checker as started or stopped.
type HealthHTTPHandler ¶
type HealthHTTPHandler struct {
Handler http.HandlerFunc
}
HealthHTTPHandler adapts an http.HandlerFunc to the HTTPHandler interface
func (*HealthHTTPHandler) Handle ¶
func (h *HealthHTTPHandler) Handle(w http.ResponseWriter, r *http.Request)
Handle implements the HTTPHandler interface
type InMemoryMessageBroker ¶
type InMemoryMessageBroker struct {
// contains filtered or unexported fields
}
InMemoryMessageBroker provides a simple in-memory implementation of MessageBroker
func NewInMemoryMessageBroker ¶
func NewInMemoryMessageBroker(name string) *InMemoryMessageBroker
NewInMemoryMessageBroker creates a new in-memory message broker
func NewInMemoryMessageBrokerWithNamespace ¶
func NewInMemoryMessageBrokerWithNamespace(name string, namespace ModuleNamespaceProvider) *InMemoryMessageBroker
NewInMemoryMessageBrokerWithNamespace creates a new in-memory message broker with namespace support
func NewStandardInMemoryMessageBroker ¶
func NewStandardInMemoryMessageBroker(namespace ModuleNamespaceProvider) *InMemoryMessageBroker
NewStandardInMemoryMessageBroker creates an in-memory message broker with the standard name
func (*InMemoryMessageBroker) Consumer ¶
func (b *InMemoryMessageBroker) Consumer() MessageConsumer
Consumer returns the message consumer interface
func (*InMemoryMessageBroker) Init ¶
func (b *InMemoryMessageBroker) Init(app modular.Application) error
Init initializes the module with the application context
func (*InMemoryMessageBroker) Name ¶
func (b *InMemoryMessageBroker) Name() string
Name returns the unique identifier for this module
func (*InMemoryMessageBroker) Producer ¶
func (b *InMemoryMessageBroker) Producer() MessageProducer
Producer returns the message producer interface
func (*InMemoryMessageBroker) ProvidesServices ¶
func (b *InMemoryMessageBroker) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns a list of services provided by this module
func (*InMemoryMessageBroker) RequiresServices ¶
func (b *InMemoryMessageBroker) RequiresServices() []modular.ServiceDependency
RequiresServices returns a list of services required by this module
func (*InMemoryMessageBroker) SendMessage ¶
func (b *InMemoryMessageBroker) SendMessage(topic string, message []byte) error
SendMessage is a convenience method to send a message to a topic
func (*InMemoryMessageBroker) Start ¶
func (b *InMemoryMessageBroker) Start(ctx context.Context) error
Start starts the message broker
func (*InMemoryMessageBroker) Stop ¶
func (b *InMemoryMessageBroker) Stop(ctx context.Context) error
Stop stops the message broker
func (*InMemoryMessageBroker) Subscribe ¶
func (b *InMemoryMessageBroker) Subscribe(topic string, handler MessageHandler) error
Subscribe is a convenience method to subscribe a handler to a topic
type IntegrationConnector ¶
type IntegrationConnector interface {
// Connect establishes a connection to the external service
Connect(ctx context.Context) error
// Disconnect closes the connection to the external service
Disconnect(ctx context.Context) error
// Execute performs an action on the external service
Execute(ctx context.Context, action string, params map[string]interface{}) (map[string]interface{}, error)
// GetName returns the name of the connector
GetName() string
// IsConnected checks if the connector is connected
IsConnected() bool
}
IntegrationConnector represents a connector to a third-party service
type IntegrationRegistry ¶
type IntegrationRegistry interface {
// Name returns the name of the registry
Name() string
// Init initializes the registry
Init(app modular.Application) error
// Start starts the registry
Start() error
// Stop stops the registry
Stop() error
// RegisterConnector registers a new integration connector
RegisterConnector(connector IntegrationConnector)
// GetConnector retrieves a connector by name
GetConnector(name string) (IntegrationConnector, error)
// ListConnectors lists all registered connectors
ListConnectors() []string
}
type JWTAuthModule ¶
type JWTAuthModule struct {
// contains filtered or unexported fields
}
JWTAuthModule handles JWT authentication with an in-memory user store
func NewJWTAuthModule ¶
func NewJWTAuthModule(name, secret string, tokenExpiry time.Duration, issuer string) *JWTAuthModule
NewJWTAuthModule creates a new JWT auth module
func (*JWTAuthModule) Authenticate ¶
func (j *JWTAuthModule) Authenticate(tokenStr string) (bool, map[string]interface{}, error)
Authenticate implements AuthProvider
func (*JWTAuthModule) Handle ¶
func (j *JWTAuthModule) Handle(w http.ResponseWriter, r *http.Request)
Handle routes auth requests
func (*JWTAuthModule) Init ¶
func (j *JWTAuthModule) Init(app modular.Application) error
Init initializes the module
func (*JWTAuthModule) ProvidesServices ¶
func (j *JWTAuthModule) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns the services provided by this module
func (*JWTAuthModule) RequiresServices ¶
func (j *JWTAuthModule) RequiresServices() []modular.ServiceDependency
RequiresServices returns services required by this module
type KafkaBroker ¶
type KafkaBroker struct {
// contains filtered or unexported fields
}
KafkaBroker implements the MessageBroker interface using Apache Kafka via Sarama.
func NewKafkaBroker ¶
func NewKafkaBroker(name string) *KafkaBroker
NewKafkaBroker creates a new Kafka message broker.
func (*KafkaBroker) Consumer ¶
func (b *KafkaBroker) Consumer() MessageConsumer
Consumer returns the message consumer interface.
func (*KafkaBroker) Init ¶
func (b *KafkaBroker) Init(app modular.Application) error
Init initializes the module with the application context.
func (*KafkaBroker) Producer ¶
func (b *KafkaBroker) Producer() MessageProducer
Producer returns the message producer interface.
func (*KafkaBroker) ProvidesServices ¶
func (b *KafkaBroker) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns the services provided by this module.
func (*KafkaBroker) RequiresServices ¶
func (b *KafkaBroker) RequiresServices() []modular.ServiceDependency
RequiresServices returns the services required by this module.
func (*KafkaBroker) SetBrokers ¶
func (b *KafkaBroker) SetBrokers(brokers []string)
SetBrokers sets the Kafka broker addresses.
func (*KafkaBroker) SetGroupID ¶
func (b *KafkaBroker) SetGroupID(groupID string)
SetGroupID sets the Kafka consumer group ID.
func (*KafkaBroker) Start ¶
func (b *KafkaBroker) Start(ctx context.Context) error
Start connects to Kafka and begins consuming.
func (*KafkaBroker) Stop ¶
func (b *KafkaBroker) Stop(_ context.Context) error
Stop disconnects from Kafka.
func (*KafkaBroker) Subscribe ¶
func (b *KafkaBroker) Subscribe(topic string, handler MessageHandler) error
Subscribe is a convenience method to subscribe a handler to a topic.
type ListenerAdapter ¶
type ListenerAdapter struct {
// contains filtered or unexported fields
}
ListenerAdapter adapts a TransitionListener function to a TransitionHandler
func NewListenerAdapter ¶
func NewListenerAdapter(listener TransitionListener) *ListenerAdapter
NewListenerAdapter creates a new adapter for a transition listener
func (*ListenerAdapter) HandleTransition ¶
func (a *ListenerAdapter) HandleTransition(ctx context.Context, event TransitionEvent) error
HandleTransition implements the TransitionHandler interface
type LoggingMiddleware ¶
type LoggingMiddleware struct {
// contains filtered or unexported fields
}
LoggingMiddleware provides request logging
func NewLoggingMiddleware ¶
func NewLoggingMiddleware(name string, logLevel string) *LoggingMiddleware
NewLoggingMiddleware creates a new logging middleware
func (*LoggingMiddleware) Init ¶
func (m *LoggingMiddleware) Init(app modular.Application) error
Init initializes the middleware
func (*LoggingMiddleware) Name ¶
func (m *LoggingMiddleware) Name() string
Name returns the module name
func (*LoggingMiddleware) Process ¶
func (m *LoggingMiddleware) Process(next http.Handler) http.Handler
Process implements middleware processing
func (*LoggingMiddleware) ProvidesServices ¶
func (m *LoggingMiddleware) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns the services provided by this middleware
func (*LoggingMiddleware) RequiresServices ¶
func (m *LoggingMiddleware) RequiresServices() []modular.ServiceDependency
RequiresServices returns services required by this middleware
type MessageBroker ¶
type MessageBroker interface {
Producer() MessageProducer
Consumer() MessageConsumer
Subscribe(topic string, handler MessageHandler) error
Start(ctx context.Context) error
Stop(ctx context.Context) error
}
MessageBroker interface for message broker modules
type MessageConsumer ¶
type MessageConsumer interface {
Subscribe(topic string, handler MessageHandler) error
Unsubscribe(topic string) error
}
MessageConsumer interface for consuming messages
type MessageHandler ¶
MessageHandler interface for handling messages
type MessageHandlerAdapter ¶
type MessageHandlerAdapter struct {
// contains filtered or unexported fields
}
MessageHandlerAdapter adapts a function to the MessageHandler interface
func (*MessageHandlerAdapter) HandleMessage ¶
func (a *MessageHandlerAdapter) HandleMessage(msg []byte) error
HandleMessage implements the MessageHandler interface
type MessageHandlerJobAdapter ¶
type MessageHandlerJobAdapter struct {
// contains filtered or unexported fields
}
MessageHandlerJobAdapter adapts a MessageHandler to the Job interface
func NewMessageHandlerJobAdapter ¶
func NewMessageHandlerJobAdapter(handler MessageHandler) *MessageHandlerJobAdapter
NewMessageHandlerJobAdapter creates a new adapter from MessageHandler to Job
type MessageProducer ¶
MessageProducer interface for producing messages
type MetricsCollector ¶
type MetricsCollector struct {
WorkflowExecutions *prometheus.CounterVec
WorkflowDuration *prometheus.HistogramVec
HTTPRequestsTotal *prometheus.CounterVec
HTTPRequestDuration *prometheus.HistogramVec
ModuleOperations *prometheus.CounterVec
ActiveWorkflows *prometheus.GaugeVec
// contains filtered or unexported fields
}
MetricsCollector wraps Prometheus metrics for the workflow engine. It registers as service "metrics.collector" and provides pre-defined metric vectors.
func NewMetricsCollector ¶
func NewMetricsCollector(name string) *MetricsCollector
NewMetricsCollector creates a new MetricsCollector with its own Prometheus registry.
func (*MetricsCollector) Handler ¶
func (m *MetricsCollector) Handler() http.Handler
Handler returns an HTTP handler that serves Prometheus metrics.
func (*MetricsCollector) Init ¶
func (m *MetricsCollector) Init(app modular.Application) error
Init registers the metrics collector as a service.
func (*MetricsCollector) Name ¶
func (m *MetricsCollector) Name() string
Name returns the module name.
func (*MetricsCollector) ProvidesServices ¶
func (m *MetricsCollector) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns the services provided by this module.
func (*MetricsCollector) RecordHTTPRequest ¶
func (m *MetricsCollector) RecordHTTPRequest(method, path string, statusCode int, duration time.Duration)
RecordHTTPRequest records an HTTP request metric.
func (*MetricsCollector) RecordModuleOperation ¶
func (m *MetricsCollector) RecordModuleOperation(module, operation, status string)
RecordModuleOperation records a module operation metric.
func (*MetricsCollector) RecordWorkflowDuration ¶
func (m *MetricsCollector) RecordWorkflowDuration(workflowType, action string, duration time.Duration)
RecordWorkflowDuration records the duration of a workflow execution.
func (*MetricsCollector) RecordWorkflowExecution ¶
func (m *MetricsCollector) RecordWorkflowExecution(workflowType, action, status string)
RecordWorkflowExecution increments the workflow execution counter.
func (*MetricsCollector) RequiresServices ¶
func (m *MetricsCollector) RequiresServices() []modular.ServiceDependency
RequiresServices returns services required by this module.
func (*MetricsCollector) SetActiveWorkflows ¶
func (m *MetricsCollector) SetActiveWorkflows(workflowType string, count float64)
SetActiveWorkflows sets the gauge for active workflows of a given type.
type MockApplication ¶
type MockApplication struct {
Services map[string]interface{}
Config map[string]interface{}
ConfigSectionMap map[string]modular.ConfigProvider
MockLogger *MockLogger
Modules map[string]modular.Module
}
MockApplication is a mock implementation of modular.Application for testing
func NewMockApplication ¶
func NewMockApplication() *MockApplication
NewMockApplication creates a new instance of a MockApplication
func (*MockApplication) ConfigProvider ¶
func (a *MockApplication) ConfigProvider() modular.ConfigProvider
func (*MockApplication) ConfigSections ¶
func (a *MockApplication) ConfigSections() map[string]modular.ConfigProvider
func (*MockApplication) GetAllModules ¶
func (a *MockApplication) GetAllModules() map[string]modular.Module
GetAllModules returns a map of all registered modules
func (*MockApplication) GetConfig ¶
func (a *MockApplication) GetConfig() map[string]interface{}
func (*MockApplication) GetConfigSection ¶
func (a *MockApplication) GetConfigSection(section string) (modular.ConfigProvider, error)
func (*MockApplication) GetModule ¶
func (a *MockApplication) GetModule(name string) modular.Module
GetModule returns the module with the given name
func (*MockApplication) GetService ¶
func (a *MockApplication) GetService(name string, out interface{}) error
func (*MockApplication) GetServiceEntry ¶
func (a *MockApplication) GetServiceEntry(serviceName string) (*modular.ServiceRegistryEntry, bool)
GetServiceEntry retrieves detailed information about a registered service
func (*MockApplication) GetServicesByInterface ¶
func (a *MockApplication) GetServicesByInterface(interfaceType reflect.Type) []*modular.ServiceRegistryEntry
GetServicesByInterface returns all services that implement the given interface
func (*MockApplication) GetServicesByModule ¶
func (a *MockApplication) GetServicesByModule(moduleName string) []string
GetServicesByModule returns all services provided by a specific module
func (*MockApplication) Init ¶
func (a *MockApplication) Init() error
func (*MockApplication) IsVerboseConfig ¶
func (a *MockApplication) IsVerboseConfig() bool
IsVerboseConfig returns whether verbose config debugging is enabled
func (*MockApplication) Logger ¶
func (a *MockApplication) Logger() modular.Logger
func (*MockApplication) OnConfigLoaded ¶
func (a *MockApplication) OnConfigLoaded(hook func(modular.Application) error)
OnConfigLoaded registers a callback to run after config loading
func (*MockApplication) RegisterConfigSection ¶
func (a *MockApplication) RegisterConfigSection(name string, config modular.ConfigProvider)
func (*MockApplication) RegisterModule ¶
func (a *MockApplication) RegisterModule(module modular.Module)
RegisterModule registers a module with the application
func (*MockApplication) RegisterService ¶
func (a *MockApplication) RegisterService(name string, service interface{}) error
func (*MockApplication) Run ¶
func (a *MockApplication) Run() error
Run satisfies the modular.Application interface
func (*MockApplication) SetLogger ¶
func (a *MockApplication) SetLogger(logger modular.Logger)
SetLogger sets the application's logger
func (*MockApplication) SetVerboseConfig ¶
func (a *MockApplication) SetVerboseConfig(enabled bool)
SetVerboseConfig sets verbose config debugging (no-op for tests)
func (*MockApplication) Start ¶
func (a *MockApplication) Start() error
func (*MockApplication) StartTime ¶
func (a *MockApplication) StartTime() time.Time
StartTime returns the time when the application was started
func (*MockApplication) Stop ¶
func (a *MockApplication) Stop() error
func (*MockApplication) SvcRegistry ¶
func (a *MockApplication) SvcRegistry() modular.ServiceRegistry
SvcRegistry satisfies the modular.Application interface
type MockConfigProvider ¶
type MockConfigProvider struct {
Config map[string]interface{} // Changed from lowercase config to Config to match usage elsewhere
}
MockConfigProvider is a mock implementation of modular.ConfigProvider for testing
func (*MockConfigProvider) GetConfig ¶
func (p *MockConfigProvider) GetConfig() any
type MockLogger ¶
type MockLogger struct {
Messages []string
}
MockLogger implements modular.Logger for testing
func (*MockLogger) Debug ¶
func (l *MockLogger) Debug(format string, args ...interface{})
func (*MockLogger) Error ¶
func (l *MockLogger) Error(format string, args ...interface{})
func (*MockLogger) Fatal ¶
func (l *MockLogger) Fatal(format string, args ...interface{})
func (*MockLogger) Info ¶
func (l *MockLogger) Info(format string, args ...interface{})
func (*MockLogger) Warn ¶
func (l *MockLogger) Warn(format string, args ...interface{})
type MockScheduler ¶
type MockScheduler struct {
// contains filtered or unexported fields
}
MockScheduler is a mock implementation of the Scheduler interface
func NewMockScheduler ¶
func NewMockScheduler() *MockScheduler
func (*MockScheduler) Init ¶
func (s *MockScheduler) Init(registry modular.ServiceRegistry) error
func (*MockScheduler) Name ¶
func (s *MockScheduler) Name() string
func (*MockScheduler) Schedule ¶
func (s *MockScheduler) Schedule(job Job) error
func (*MockScheduler) SetCronExpression ¶
func (s *MockScheduler) SetCronExpression(index int, cronExpression string)
For our tests, we'll add this method to set the cron expression for a scheduled job
type MockWorkflowEngine ¶
type MockWorkflowEngine struct {
// contains filtered or unexported fields
}
MockWorkflowEngine is a mock implementation of the WorkflowEngine interface
func NewMockWorkflowEngine ¶
func NewMockWorkflowEngine() *MockWorkflowEngine
func (*MockWorkflowEngine) TriggerWorkflow ¶
type ModuleNamespace ¶
type ModuleNamespace struct {
// contains filtered or unexported fields
}
ModuleNamespace represents the legacy struct (for backward compatibility)
func NewModuleNamespace ¶
func NewModuleNamespace(prefix string, suffix string) *ModuleNamespace
NewModuleNamespace creates a new module namespace with optional prefix and suffix
func (*ModuleNamespace) FormatName ¶
func (ns *ModuleNamespace) FormatName(baseName string) string
FormatName formats a module name with the namespace prefix/suffix
func (*ModuleNamespace) ResolveDependency ¶
func (ns *ModuleNamespace) ResolveDependency(dependencyName string) string
ResolveDependency formats a dependency name with the namespace prefix/suffix
func (*ModuleNamespace) ResolveServiceName ¶
func (ns *ModuleNamespace) ResolveServiceName(serviceName string) string
ResolveServiceName formats a service name with the namespace prefix/suffix
type ModuleNamespaceProvider ¶
type ModuleNamespaceProvider interface {
// FormatName formats a module name with the namespace
FormatName(baseName string) string
// ResolveDependency formats a dependency name with the namespace
ResolveDependency(dependencyName string) string
// ResolveServiceName formats a service name with the namespace
ResolveServiceName(serviceName string) string
// ValidateModuleName checks if a module name conforms to namespace requirements
ValidateModuleName(moduleName string) error
}
ModuleNamespaceProvider defines the interface for module namespace functionality
type ModuleNamespaceProviderFunc ¶
type ModuleNamespaceProviderFunc struct {
FormatNameFunc func(baseName string) string
ResolveDependencyFunc func(dependencyName string) string
ResolveServiceNameFunc func(serviceName string) string
ValidateModuleNameFunc func(moduleName string) error
}
ModuleNamespaceProviderFunc provides a functional implementation of ModuleNamespaceProvider
func (ModuleNamespaceProviderFunc) FormatName ¶
func (m ModuleNamespaceProviderFunc) FormatName(baseName string) string
FormatName formats a base name with the namespace
func (ModuleNamespaceProviderFunc) ResolveDependency ¶
func (m ModuleNamespaceProviderFunc) ResolveDependency(dependencyName string) string
ResolveDependency resolves a dependency name with the namespace
func (ModuleNamespaceProviderFunc) ResolveServiceName ¶
func (m ModuleNamespaceProviderFunc) ResolveServiceName(serviceName string) string
ResolveServiceName resolves a service name with the namespace
func (ModuleNamespaceProviderFunc) ValidateModuleName ¶
func (m ModuleNamespaceProviderFunc) ValidateModuleName(moduleName string) error
ValidateModuleName validates a module name
type NATSBroker ¶
type NATSBroker struct {
// contains filtered or unexported fields
}
NATSBroker implements the MessageBroker interface using NATS.
func NewNATSBroker ¶
func NewNATSBroker(name string) *NATSBroker
NewNATSBroker creates a new NATS message broker.
func (*NATSBroker) Consumer ¶
func (b *NATSBroker) Consumer() MessageConsumer
Consumer returns the message consumer interface.
func (*NATSBroker) Init ¶
func (b *NATSBroker) Init(app modular.Application) error
Init initializes the module with the application context.
func (*NATSBroker) Producer ¶
func (b *NATSBroker) Producer() MessageProducer
Producer returns the message producer interface.
func (*NATSBroker) ProvidesServices ¶
func (b *NATSBroker) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns the services provided by this module.
func (*NATSBroker) RequiresServices ¶
func (b *NATSBroker) RequiresServices() []modular.ServiceDependency
RequiresServices returns the services required by this module.
func (*NATSBroker) SetURL ¶
func (b *NATSBroker) SetURL(url string)
SetURL sets the NATS server URL.
func (*NATSBroker) Start ¶
func (b *NATSBroker) Start(ctx context.Context) error
Start connects to NATS and activates any pending subscriptions.
func (*NATSBroker) Stop ¶
func (b *NATSBroker) Stop(_ context.Context) error
Stop disconnects from NATS.
func (*NATSBroker) Subscribe ¶
func (b *NATSBroker) Subscribe(topic string, handler MessageHandler) error
Subscribe is a convenience method to subscribe a handler to a topic.
type OTelTracing ¶
type OTelTracing struct {
// contains filtered or unexported fields
}
OTelTracing provides OpenTelemetry distributed tracing. It implements the modular.Module interface.
func NewOTelTracing ¶
func NewOTelTracing(name string) *OTelTracing
NewOTelTracing creates a new OpenTelemetry tracing module.
func (*OTelTracing) Init ¶
func (o *OTelTracing) Init(app modular.Application) error
Init initializes the module with the application context.
func (*OTelTracing) ProvidesServices ¶
func (o *OTelTracing) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns the services provided by this module.
func (*OTelTracing) RequiresServices ¶
func (o *OTelTracing) RequiresServices() []modular.ServiceDependency
RequiresServices returns the services required by this module.
func (*OTelTracing) SetEndpoint ¶
func (o *OTelTracing) SetEndpoint(endpoint string)
SetEndpoint sets the OTLP endpoint.
func (*OTelTracing) SetServiceName ¶
func (o *OTelTracing) SetServiceName(serviceName string)
SetServiceName sets the service name used in traces.
type PatternMatch ¶
type PatternMatch struct {
PatternID string `json:"patternId"`
Events []EventData `json:"events"`
MatchedTime time.Time `json:"matchedTime"`
}
PatternMatch represents a successful pattern match
type QueryResult ¶
type QueryResult struct {
Columns []string `json:"columns"`
Rows []map[string]interface{} `json:"rows"`
Count int `json:"count"`
}
QueryResult represents the result of a query
type RESTAPIHandler ¶
type RESTAPIHandler struct {
// contains filtered or unexported fields
}
RESTAPIHandler provides CRUD operations for a REST API
func NewRESTAPIHandler ¶
func NewRESTAPIHandler(name, resourceName string) *RESTAPIHandler
NewRESTAPIHandler creates a new REST API handler
func (*RESTAPIHandler) Constructor ¶
func (h *RESTAPIHandler) Constructor() modular.ModuleConstructor
Constructor returns a function to construct this module with dependencies
func (*RESTAPIHandler) Handle ¶
func (h *RESTAPIHandler) Handle(w http.ResponseWriter, r *http.Request)
Handle implements the HTTPHandler interface
func (*RESTAPIHandler) Init ¶
func (h *RESTAPIHandler) Init(app modular.Application) error
Init initializes the module with the application context
func (*RESTAPIHandler) Name ¶
func (h *RESTAPIHandler) Name() string
Name returns the unique identifier for this module
func (*RESTAPIHandler) ProvidesServices ¶
func (h *RESTAPIHandler) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns the services provided by this module
func (*RESTAPIHandler) RequiresServices ¶
func (h *RESTAPIHandler) RequiresServices() []modular.ServiceDependency
RequiresServices returns the services required by this module
func (*RESTAPIHandler) SetSeedFile ¶
func (h *RESTAPIHandler) SetSeedFile(path string)
SetSeedFile sets the path to a JSON seed data file.
func (*RESTAPIHandler) SetWorkflowEngine ¶
func (h *RESTAPIHandler) SetWorkflowEngine(we string)
SetWorkflowEngine sets the name of the workflow engine service to use.
func (*RESTAPIHandler) SetWorkflowType ¶
func (h *RESTAPIHandler) SetWorkflowType(wt string)
SetWorkflowType sets the workflow type for state machine operations.
type RESTAPIHandlerConfig ¶
type RESTAPIHandlerConfig struct {
ResourceName string `json:"resourceName" yaml:"resourceName"`
PublishEvents bool `json:"publishEvents" yaml:"publishEvents"`
WorkflowType string `json:"workflowType" yaml:"workflowType"` // The type of workflow to use for state machine operations
WorkflowEngine string `json:"workflowEngine" yaml:"workflowEngine"` // The name of the workflow engine to use
InstanceIDPrefix string `json:"instanceIDPrefix" yaml:"instanceIDPrefix"` // Optional prefix for workflow instance IDs
InstanceIDField string `json:"instanceIDField" yaml:"instanceIDField"` // Field in resource data to use for instance ID (defaults to "id")
}
RESTAPIHandlerConfig contains configuration for a REST API handler
type RESTResource ¶
type RESTResource struct {
ID string `json:"id"`
Data map[string]interface{} `json:"data"`
State string `json:"state,omitempty"`
LastUpdate string `json:"lastUpdate,omitempty"`
}
RESTResource represents a simple in-memory resource store for REST APIs
type RateLimitMiddleware ¶
type RateLimitMiddleware struct {
// contains filtered or unexported fields
}
RateLimitMiddleware implements a rate limiting middleware
func NewRateLimitMiddleware ¶
func NewRateLimitMiddleware(name string, requestsPerMinute, burstSize int) *RateLimitMiddleware
NewRateLimitMiddleware creates a new rate limiting middleware
func (*RateLimitMiddleware) Init ¶
func (m *RateLimitMiddleware) Init(app modular.Application) error
Init initializes the middleware
func (*RateLimitMiddleware) Name ¶
func (m *RateLimitMiddleware) Name() string
Name returns the module name
func (*RateLimitMiddleware) Process ¶
func (m *RateLimitMiddleware) Process(next http.Handler) http.Handler
Process implements middleware processing
func (*RateLimitMiddleware) ProvidesServices ¶
func (m *RateLimitMiddleware) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns the services provided by this middleware
func (*RateLimitMiddleware) RequiresServices ¶
func (m *RateLimitMiddleware) RequiresServices() []modular.ServiceDependency
RequiresServices returns services required by this middleware
type RequestIDMiddleware ¶
type RequestIDMiddleware struct {
// contains filtered or unexported fields
}
RequestIDMiddleware reads X-Request-ID header or generates a UUID, sets it on the context and response header.
func NewRequestIDMiddleware ¶
func NewRequestIDMiddleware(name string) *RequestIDMiddleware
NewRequestIDMiddleware creates a new RequestIDMiddleware.
func (*RequestIDMiddleware) Init ¶
func (m *RequestIDMiddleware) Init(app modular.Application) error
Init registers the middleware as a service.
func (*RequestIDMiddleware) Middleware ¶
func (m *RequestIDMiddleware) Middleware() func(http.Handler) http.Handler
Middleware returns the HTTP middleware function.
func (*RequestIDMiddleware) Name ¶
func (m *RequestIDMiddleware) Name() string
Name returns the module name.
func (*RequestIDMiddleware) Process ¶
func (m *RequestIDMiddleware) Process(next http.Handler) http.Handler
Process implements the HTTPMiddleware interface.
func (*RequestIDMiddleware) ProvidesServices ¶
func (m *RequestIDMiddleware) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns the services provided by this module.
func (*RequestIDMiddleware) RequiresServices ¶
func (m *RequestIDMiddleware) RequiresServices() []modular.ServiceDependency
RequiresServices returns services required by this module.
type ResourceStateMapping ¶
type ResourceStateMapping struct {
ResourceType string // Type of resource (e.g., "orders", "users")
StateMachine string // Name of the state machine
InstanceIDKey string // Field in resource data that maps to state machine instance ID
}
ResourceStateMapping defines how a resource maps to a state machine
type Route ¶
type Route struct {
Method string
Path string
Handler HTTPHandler
Middlewares []HTTPMiddleware
}
Route represents an HTTP route
type S3Storage ¶
type S3Storage struct {
// contains filtered or unexported fields
}
S3Storage provides object storage operations using AWS S3. It implements the modular.Module interface.
func NewS3Storage ¶
NewS3Storage creates a new S3 storage module.
func (*S3Storage) DeleteObject ¶
DeleteObject removes an object from S3.
func (*S3Storage) Init ¶
func (s *S3Storage) Init(app modular.Application) error
Init initializes the module with the application context.
func (*S3Storage) ProvidesServices ¶
func (s *S3Storage) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns the services provided by this module.
func (*S3Storage) RequiresServices ¶
func (s *S3Storage) RequiresServices() []modular.ServiceDependency
RequiresServices returns the services required by this module.
func (*S3Storage) SetEndpoint ¶
SetEndpoint sets a custom endpoint (for LocalStack/MinIO).
type ScheduleTrigger ¶
type ScheduleTrigger struct {
// contains filtered or unexported fields
}
ScheduleTrigger implements a trigger that starts workflows based on a schedule
func NewScheduleTrigger ¶
func NewScheduleTrigger() *ScheduleTrigger
NewScheduleTrigger creates a new schedule trigger
func NewScheduleTriggerWithNamespace ¶
func NewScheduleTriggerWithNamespace(namespace ModuleNamespaceProvider) *ScheduleTrigger
NewScheduleTriggerWithNamespace creates a new schedule trigger with namespace support
func (*ScheduleTrigger) Configure ¶
func (t *ScheduleTrigger) Configure(app modular.Application, triggerConfig interface{}) error
Configure sets up the trigger from configuration
func (*ScheduleTrigger) Init ¶
func (t *ScheduleTrigger) Init(app modular.Application) error
Init initializes the trigger
func (*ScheduleTrigger) Name ¶
func (t *ScheduleTrigger) Name() string
Name returns the name of this trigger
type ScheduleTriggerConfig ¶
type ScheduleTriggerConfig struct {
Jobs []ScheduleTriggerJob `json:"jobs" yaml:"jobs"`
}
ScheduleTriggerConfig represents the configuration for a schedule trigger
type ScheduleTriggerJob ¶
type ScheduleTriggerJob struct {
Cron string `json:"cron" yaml:"cron"`
Workflow string `json:"workflow" yaml:"workflow"`
Action string `json:"action" yaml:"action"`
Params map[string]interface{} `json:"params,omitempty" yaml:"params,omitempty"`
}
ScheduleTriggerJob represents a single scheduled job configuration
type ScheduledJobInfo ¶
type ScheduledJobInfo struct {
// contains filtered or unexported fields
}
ScheduledJobInfo captures information about a scheduled job
type Scheduler ¶
type Scheduler interface {
Schedule(job Job) error
Start(ctx context.Context) error
Stop(ctx context.Context) error
}
Scheduler represents a job scheduler
type ServiceRegistry ¶
type ServiceRegistry interface {
// GetService returns a service by name
GetService(name string, out interface{}) error
// RegisterService registers a service with the application
RegisterService(name string, service interface{}) error
}
ServiceRegistry defines the interface for registering and retrieving services
type SimpleHTTPHandler ¶
type SimpleHTTPHandler struct {
// contains filtered or unexported fields
}
SimpleHTTPHandler provides a basic implementation of an HTTP handler
func NewSimpleHTTPHandler ¶
func NewSimpleHTTPHandler(name string, contentType string) *SimpleHTTPHandler
NewSimpleHTTPHandler creates a new HTTP handler with the given name
func (*SimpleHTTPHandler) Handle ¶
func (h *SimpleHTTPHandler) Handle(w http.ResponseWriter, r *http.Request)
Handle implements the HTTPHandler interface
func (*SimpleHTTPHandler) Init ¶
func (h *SimpleHTTPHandler) Init(app modular.Application) error
Init initializes the HTTP handler
func (*SimpleHTTPHandler) Name ¶
func (h *SimpleHTTPHandler) Name() string
Name returns the unique identifier for this module
func (*SimpleHTTPHandler) ProvidesServices ¶
func (h *SimpleHTTPHandler) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns a list of services provided by this module
func (*SimpleHTTPHandler) RequiresServices ¶
func (h *SimpleHTTPHandler) RequiresServices() []modular.ServiceDependency
RequiresServices returns a list of services required by this module
func (*SimpleHTTPHandler) ServeHTTP ¶
func (h *SimpleHTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements the http.Handler interface
func (*SimpleHTTPHandler) SetHandleFunc ¶
func (h *SimpleHTTPHandler) SetHandleFunc(fn func(w http.ResponseWriter, r *http.Request))
SetHandleFunc sets a custom handler function
type SimpleMessageHandler ¶
type SimpleMessageHandler struct {
// contains filtered or unexported fields
}
SimpleMessageHandler provides a basic implementation of a message handler
func NewSimpleMessageHandler ¶
func NewSimpleMessageHandler(name string) *SimpleMessageHandler
NewSimpleMessageHandler creates a new message handler with the given name
func NewSimpleMessageHandlerWithNamespace ¶
func NewSimpleMessageHandlerWithNamespace(name string, namespace ModuleNamespaceProvider) *SimpleMessageHandler
NewSimpleMessageHandlerWithNamespace creates a new message handler with namespace support
func NewStandardSimpleMessageHandler ¶
func NewStandardSimpleMessageHandler(handlerType string, namespace ModuleNamespaceProvider) *SimpleMessageHandler
NewStandardSimpleMessageHandler creates a message handler with standard name
func (*SimpleMessageHandler) Constructor ¶
func (h *SimpleMessageHandler) Constructor() modular.ModuleConstructor
Constructor returns a function to construct this module with dependencies
func (*SimpleMessageHandler) Dependencies ¶
func (h *SimpleMessageHandler) Dependencies() []string
Dependencies returns the names of other modules this module depends on
func (*SimpleMessageHandler) HandleMessage ¶
func (h *SimpleMessageHandler) HandleMessage(message []byte) error
HandleMessage implements the MessageHandler interface
func (*SimpleMessageHandler) Init ¶
func (h *SimpleMessageHandler) Init(app modular.Application) error
Init initializes the module with the application context
func (*SimpleMessageHandler) Name ¶
func (h *SimpleMessageHandler) Name() string
Name returns the unique identifier for this module
func (*SimpleMessageHandler) ProvidesServices ¶
func (h *SimpleMessageHandler) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns a list of services provided by this module
func (*SimpleMessageHandler) RequiresServices ¶
func (h *SimpleMessageHandler) RequiresServices() []modular.ServiceDependency
RequiresServices returns a list of services required by this module
func (*SimpleMessageHandler) SetBrokerDependencies ¶
func (h *SimpleMessageHandler) SetBrokerDependencies(brokerNames []string)
SetBrokerDependencies sets which message broker modules this handler depends on
func (*SimpleMessageHandler) SetHandleFunc ¶
func (h *SimpleMessageHandler) SetHandleFunc(fn func(message []byte) error)
SetHandleFunc sets a custom handler function
func (*SimpleMessageHandler) SetProducer ¶
func (h *SimpleMessageHandler) SetProducer(producer MessageProducer)
SetProducer sets the message producer for forwarding
func (*SimpleMessageHandler) SetTargetTopics ¶
func (h *SimpleMessageHandler) SetTargetTopics(topics []string)
SetTargetTopics configures topics to forward messages to
type SimpleTokenProvider ¶
type SimpleTokenProvider struct {
// contains filtered or unexported fields
}
SimpleTokenProvider implements a simple token-based auth provider
func (*SimpleTokenProvider) Authenticate ¶
func (p *SimpleTokenProvider) Authenticate(token string) (bool, map[string]interface{}, error)
Authenticate checks if the token is valid and returns associated claims
type SlackNotification ¶
type SlackNotification struct {
// contains filtered or unexported fields
}
SlackNotification sends messages to a Slack webhook URL. It implements both the MessageHandler and modular.Module interfaces.
func NewSlackNotification ¶
func NewSlackNotification(name string) *SlackNotification
NewSlackNotification creates a new Slack notification module.
func (*SlackNotification) HandleMessage ¶
func (s *SlackNotification) HandleMessage(message []byte) error
HandleMessage sends a message to the configured Slack webhook.
func (*SlackNotification) Init ¶
func (s *SlackNotification) Init(app modular.Application) error
Init initializes the module with the application context.
func (*SlackNotification) Name ¶
func (s *SlackNotification) Name() string
Name returns the module name.
func (*SlackNotification) ProvidesServices ¶
func (s *SlackNotification) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns the services provided by this module.
func (*SlackNotification) RequiresServices ¶
func (s *SlackNotification) RequiresServices() []modular.ServiceDependency
RequiresServices returns the services required by this module.
func (*SlackNotification) SetChannel ¶
func (s *SlackNotification) SetChannel(channel string)
SetChannel sets the Slack channel.
func (*SlackNotification) SetClient ¶
func (s *SlackNotification) SetClient(client *http.Client)
SetClient sets a custom HTTP client (useful for testing).
func (*SlackNotification) SetUsername ¶
func (s *SlackNotification) SetUsername(username string)
SetUsername sets the Slack username.
func (*SlackNotification) SetWebhookURL ¶
func (s *SlackNotification) SetWebhookURL(url string)
SetWebhookURL sets the Slack webhook URL.
type StandardHTTPHandler ¶
type StandardHTTPHandler struct {
// contains filtered or unexported fields
}
StandardHTTPHandler adapts a function to the HTTPHandler interface
func (*StandardHTTPHandler) Handle ¶
func (h *StandardHTTPHandler) Handle(w http.ResponseWriter, r *http.Request)
Handle implements the HTTPHandler interface
func (*StandardHTTPHandler) ServeHTTP ¶
func (h *StandardHTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request, params map[string]string)
ServeHTTP implements the http.Handler interface (for compatibility)
type StandardHTTPRouter ¶
type StandardHTTPRouter struct {
// contains filtered or unexported fields
}
StandardHTTPRouter implements both HTTPRouter and http.Handler interfaces
func NewStandardHTTPRouter ¶
func NewStandardHTTPRouter(name string) *StandardHTTPRouter
NewStandardHTTPRouter creates a new HTTP router
func (*StandardHTTPRouter) AddRoute ¶
func (r *StandardHTTPRouter) AddRoute(method, path string, handler HTTPHandler)
AddRoute adds a route to the router
func (*StandardHTTPRouter) AddRouteWithMiddleware ¶
func (r *StandardHTTPRouter) AddRouteWithMiddleware(method, path string, handler HTTPHandler, middlewares []HTTPMiddleware)
AddRouteWithMiddleware adds a route with middleware to the router
func (*StandardHTTPRouter) Constructor ¶
func (r *StandardHTTPRouter) Constructor() modular.ModuleConstructor
Constructor returns a function to construct this module with dependencies
func (*StandardHTTPRouter) Dependencies ¶
func (r *StandardHTTPRouter) Dependencies() []string
Dependencies returns names of other modules this module depends on
func (*StandardHTTPRouter) HasRoute ¶
func (r *StandardHTTPRouter) HasRoute(method, path string) bool
HasRoute checks if a route with the given method and path already exists
func (*StandardHTTPRouter) Init ¶
func (r *StandardHTTPRouter) Init(app modular.Application) error
Init initializes the module with the application context
func (*StandardHTTPRouter) Name ¶
func (r *StandardHTTPRouter) Name() string
Name returns the unique identifier for this module
func (*StandardHTTPRouter) ProvidesServices ¶
func (r *StandardHTTPRouter) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns a list of services provided by this module
func (*StandardHTTPRouter) RequiresServices ¶
func (r *StandardHTTPRouter) RequiresServices() []modular.ServiceDependency
RequiresServices returns a list of services required by this module
func (*StandardHTTPRouter) ServeHTTP ¶
func (r *StandardHTTPRouter) ServeHTTP(w http.ResponseWriter, req *http.Request)
ServeHTTP implements the http.Handler interface
func (*StandardHTTPRouter) SetServerDependencies ¶
func (r *StandardHTTPRouter) SetServerDependencies(serverNames []string)
SetServerDependencies sets which HTTP server modules this router depends on
type StandardHTTPServer ¶
type StandardHTTPServer struct {
// contains filtered or unexported fields
}
StandardHTTPServer implements the HTTPServer interface and modular.Module interfaces
func NewStandardHTTPServer ¶
func NewStandardHTTPServer(name, address string) *StandardHTTPServer
NewStandardHTTPServer creates a new HTTP server with the given name and address
func (*StandardHTTPServer) AddRouter ¶
func (s *StandardHTTPServer) AddRouter(router HTTPRouter)
AddRouter adds a router to the HTTP server
func (*StandardHTTPServer) Init ¶
func (s *StandardHTTPServer) Init(app modular.Application) error
Init initializes the module with the application context
func (*StandardHTTPServer) Name ¶
func (s *StandardHTTPServer) Name() string
Name returns the unique identifier for this module
func (*StandardHTTPServer) ProvidesServices ¶
func (s *StandardHTTPServer) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns a list of services provided by this module
func (*StandardHTTPServer) RequiresServices ¶
func (s *StandardHTTPServer) RequiresServices() []modular.ServiceDependency
RequiresServices returns a list of services required by this module
type StandardNamespace ¶
type StandardNamespace struct {
// contains filtered or unexported fields
}
StandardNamespace provides a standard implementation of ModuleNamespaceProvider
func NewStandardNamespace ¶
func NewStandardNamespace(prefix string, suffix string) *StandardNamespace
NewStandardNamespace creates a new standard namespace with optional prefix and suffix
func (*StandardNamespace) FormatName ¶
func (ns *StandardNamespace) FormatName(baseName string) string
FormatName formats a module name with the namespace prefix/suffix
func (*StandardNamespace) ResolveDependency ¶
func (ns *StandardNamespace) ResolveDependency(dependencyName string) string
ResolveDependency formats a dependency name with the namespace prefix/suffix
func (*StandardNamespace) ResolveServiceName ¶
func (ns *StandardNamespace) ResolveServiceName(serviceName string) string
ResolveServiceName formats a service name with the namespace prefix/suffix
func (*StandardNamespace) ValidateModuleName ¶
func (ns *StandardNamespace) ValidateModuleName(moduleName string) error
ValidateModuleName checks if a module name conforms to namespace requirements
type State ¶
type State struct {
Name string `json:"name" yaml:"name"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"`
IsFinal bool `json:"isFinal" yaml:"isFinal"`
IsError bool `json:"isError" yaml:"isError"`
}
State represents a workflow state
type StateChangeListener ¶
type StateChangeListener func(previousState, newState string, resourceID string, data map[string]interface{})
StateChangeListener is a function that gets called when state changes
type StateInfo ¶
type StateInfo struct {
ID string `json:"id"`
ResourceType string `json:"resourceType"`
CurrentState string `json:"currentState"`
PreviousState string `json:"previousState,omitempty"`
LastUpdate time.Time `json:"lastUpdate"`
Data map[string]interface{} `json:"data,omitempty"`
}
StateInfo represents state information for a resource
type StateMachineDefinition ¶
type StateMachineDefinition struct {
Name string `json:"name" yaml:"name"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
States map[string]*State `json:"states" yaml:"states"`
Transitions map[string]*Transition `json:"transitions" yaml:"transitions"`
InitialState string `json:"initialState" yaml:"initialState"`
Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"`
}
StateMachineDefinition defines a state machine workflow
type StateMachineEngine ¶
type StateMachineEngine struct {
// contains filtered or unexported fields
}
StateMachineEngine implements a workflow state machine engine
func NewStandardStateMachineEngine ¶
func NewStandardStateMachineEngine(namespace ModuleNamespaceProvider) *StateMachineEngine
NewStandardStateMachineEngine creates a state machine engine with the standard name
func NewStateMachineEngine ¶
func NewStateMachineEngine(name string) *StateMachineEngine
NewStateMachineEngine creates a new state machine engine
func NewStateMachineEngineWithNamespace ¶
func NewStateMachineEngineWithNamespace(name string, namespace ModuleNamespaceProvider) *StateMachineEngine
NewStateMachineEngineWithNamespace creates a new state machine engine with namespace support
func (*StateMachineEngine) AddGlobalTransitionHandler ¶
func (e *StateMachineEngine) AddGlobalTransitionHandler(handler TransitionHandler)
AddGlobalTransitionHandler adds a handler for all transitions
func (*StateMachineEngine) AddTransitionListener ¶
func (e *StateMachineEngine) AddTransitionListener(listener TransitionListener)
AddTransitionListener registers a function to be called on every transition
func (*StateMachineEngine) CreateWorkflow ¶
func (e *StateMachineEngine) CreateWorkflow( workflowType string, id string, initialData map[string]interface{}, ) (*WorkflowInstance, error)
CreateWorkflow creates a new workflow instance
func (*StateMachineEngine) GetAllInstances ¶
func (e *StateMachineEngine) GetAllInstances() ([]*WorkflowInstance, error)
GetAllInstances returns all workflow instances
func (*StateMachineEngine) GetInstance ¶
func (e *StateMachineEngine) GetInstance(id string) (*WorkflowInstance, error)
GetInstance retrieves a workflow instance by ID
func (*StateMachineEngine) GetInstancesByType ¶
func (e *StateMachineEngine) GetInstancesByType(workflowType string) ([]*WorkflowInstance, error)
GetInstancesByType retrieves workflow instances by type
func (*StateMachineEngine) GetTransitionHandler ¶
func (e *StateMachineEngine) GetTransitionHandler() TransitionHandler
GetTransitionHandler returns the current transition handler
func (*StateMachineEngine) HasTransitionHandler ¶
func (e *StateMachineEngine) HasTransitionHandler() bool
HasTransitionHandler checks if a transition handler is set
func (*StateMachineEngine) Init ¶
func (e *StateMachineEngine) Init(app modular.Application) error
Init initializes the state machine engine
func (*StateMachineEngine) Name ¶
func (e *StateMachineEngine) Name() string
Name returns the module name
func (*StateMachineEngine) ProvidesServices ¶
func (e *StateMachineEngine) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns services provided by this module
func (*StateMachineEngine) RegisterDefinition ¶
func (e *StateMachineEngine) RegisterDefinition(def *StateMachineDefinition) error
RegisterDefinition registers a state machine definition
func (*StateMachineEngine) RegisterWorkflow ¶
func (e *StateMachineEngine) RegisterWorkflow(def ExternalStateMachineDefinition) error
RegisterWorkflow registers a workflow definition
func (*StateMachineEngine) RequiresServices ¶
func (e *StateMachineEngine) RequiresServices() []modular.ServiceDependency
RequiresServices returns services required by this module
func (*StateMachineEngine) SetTransitionHandler ¶
func (e *StateMachineEngine) SetTransitionHandler(handler TransitionHandler)
SetTransitionHandler sets the handler for all state transitions
func (*StateMachineEngine) Start ¶
func (e *StateMachineEngine) Start(ctx context.Context) error
Start starts the state machine engine
func (*StateMachineEngine) Stop ¶
func (e *StateMachineEngine) Stop(ctx context.Context) error
Stop stops the state machine engine
func (*StateMachineEngine) TriggerTransition ¶
func (e *StateMachineEngine) TriggerTransition( ctx context.Context, workflowID string, transitionName string, data map[string]interface{}, ) error
TriggerTransition attempts to transition a workflow's state
type StateMachineStateConfig ¶
type StateMachineStateConfig struct {
ID string `json:"id" yaml:"id"`
Description string `json:"description,omitempty" yaml:"description,omitempty"`
IsFinal bool `json:"isFinal" yaml:"isFinal"`
IsError bool `json:"isError" yaml:"isError"`
Data map[string]interface{} `json:"data,omitempty" yaml:"data,omitempty"`
}
StateMachineStateConfig represents configuration for a state machine state
type StateMachineStateConnector ¶
type StateMachineStateConnector struct {
// contains filtered or unexported fields
}
StateMachineStateConnector connects state machines to state tracking
func NewStateMachineStateConnector ¶
func NewStateMachineStateConnector(name string) *StateMachineStateConnector
NewStateMachineStateConnector creates a new connector
func (*StateMachineStateConnector) Configure ¶
func (c *StateMachineStateConnector) Configure(mappings []ResourceStateMapping) error
Configure sets up the connector with resource mappings
func (*StateMachineStateConnector) GetEngineForResourceType ¶
func (c *StateMachineStateConnector) GetEngineForResourceType(resourceType string) (string, bool)
GetEngineForResourceType finds the state machine engine for a resource type
func (*StateMachineStateConnector) GetResourceState ¶
func (c *StateMachineStateConnector) GetResourceState(resourceType, resourceID string) (string, map[string]interface{}, error)
GetResourceState gets the current state for a resource
func (*StateMachineStateConnector) Init ¶
func (c *StateMachineStateConnector) Init(app modular.Application) error
Init initializes the connector
func (*StateMachineStateConnector) Name ¶
func (c *StateMachineStateConnector) Name() string
Name returns the service name
func (*StateMachineStateConnector) ProvidesServices ¶
func (c *StateMachineStateConnector) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns the services provided by this module
func (*StateMachineStateConnector) RegisterMapping ¶
func (c *StateMachineStateConnector) RegisterMapping(resourceType, stateMachine, instanceIDKey string)
RegisterMapping adds a resource mapping
func (*StateMachineStateConnector) RequiresServices ¶
func (c *StateMachineStateConnector) RequiresServices() []modular.ServiceDependency
RequiresServices returns the services required by this module
func (*StateMachineStateConnector) Start ¶
func (c *StateMachineStateConnector) Start(ctx context.Context) error
Start connects to state machines and sets up listeners
func (*StateMachineStateConnector) Stop ¶
func (c *StateMachineStateConnector) Stop(ctx context.Context) error
Stop stops the connector
func (*StateMachineStateConnector) UpdateResourceState ¶
func (c *StateMachineStateConnector) UpdateResourceState(resourceType, resourceID string) error
UpdateResourceState gets the current state from the state machine and updates the tracker
type StateMachineTransitionConfig ¶
type StateMachineTransitionConfig struct {
ID string `json:"id" yaml:"id"`
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]interface{} `json:"data,omitempty" yaml:"data,omitempty"`
}
StateMachineTransitionConfig represents configuration for a state transition
type StateTracker ¶
type StateTracker struct {
// contains filtered or unexported fields
}
StateTracker provides a generic service for tracking state
func NewStateTracker ¶
func NewStateTracker(name string) *StateTracker
NewStateTracker creates a new state tracker service
func (*StateTracker) AddStateChangeListener ¶
func (s *StateTracker) AddStateChangeListener(resourceType string, listener StateChangeListener)
AddStateChangeListener adds a listener for state changes of a specific resource type
func (*StateTracker) GetState ¶
func (s *StateTracker) GetState(resourceType, resourceID string) (StateInfo, bool)
GetState retrieves state information for a resource
func (*StateTracker) Init ¶
func (s *StateTracker) Init(app modular.Application) error
Init initializes the service
func (*StateTracker) ProvidesServices ¶
func (s *StateTracker) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns the services provided by this module
func (*StateTracker) RequiresServices ¶
func (s *StateTracker) RequiresServices() []modular.ServiceDependency
RequiresServices returns the services required by this module
func (*StateTracker) SetState ¶
func (s *StateTracker) SetState(resourceType, resourceID, state string, data map[string]interface{})
SetState updates the state for a resource
type StaticFileServer ¶
type StaticFileServer struct {
// contains filtered or unexported fields
}
StaticFileServer serves static files from a directory with optional SPA fallback
func NewStaticFileServer ¶
func NewStaticFileServer(name, root, prefix string, spaFallback bool, cacheMaxAge int) *StaticFileServer
NewStaticFileServer creates a new static file server module
func (*StaticFileServer) Handle ¶
func (s *StaticFileServer) Handle(w http.ResponseWriter, r *http.Request)
Handle serves static files
func (*StaticFileServer) Init ¶
func (s *StaticFileServer) Init(app modular.Application) error
Init initializes the module
func (*StaticFileServer) Name ¶
func (s *StaticFileServer) Name() string
Name returns the module name
func (*StaticFileServer) Prefix ¶
func (s *StaticFileServer) Prefix() string
Prefix returns the URL prefix for this file server
func (*StaticFileServer) ProvidesServices ¶
func (s *StaticFileServer) ProvidesServices() []modular.ServiceProvider
ProvidesServices returns the services provided by this module
func (*StaticFileServer) RequiresServices ¶
func (s *StaticFileServer) RequiresServices() []modular.ServiceDependency
RequiresServices returns services required by this module
type StdIntegrationRegistry ¶
type StdIntegrationRegistry struct {
// contains filtered or unexported fields
}
StdIntegrationRegistry manages available integration connectors
func NewIntegrationRegistry ¶
func NewIntegrationRegistry(name string) *StdIntegrationRegistry
NewIntegrationRegistry creates a new integration registry
func (*StdIntegrationRegistry) GetConnector ¶
func (r *StdIntegrationRegistry) GetConnector(name string) (IntegrationConnector, error)
GetConnector retrieves a connector by name
func (*StdIntegrationRegistry) Init ¶
func (r *StdIntegrationRegistry) Init(app modular.Application) error
Init initializes the registry with service dependencies
func (*StdIntegrationRegistry) ListConnectors ¶
func (r *StdIntegrationRegistry) ListConnectors() []string
ListConnectors returns all registered connectors
func (*StdIntegrationRegistry) Name ¶
func (r *StdIntegrationRegistry) Name() string
Name returns the module name
func (*StdIntegrationRegistry) RegisterConnector ¶
func (r *StdIntegrationRegistry) RegisterConnector(connector IntegrationConnector)
RegisterConnector adds a connector to the registry
func (*StdIntegrationRegistry) Start ¶
func (r *StdIntegrationRegistry) Start() error
Start starts all registered connectors
func (*StdIntegrationRegistry) Stop ¶
func (r *StdIntegrationRegistry) Stop() error
Stop stops all registered connectors
type StepLifecycleEvent ¶
type StepLifecycleEvent struct {
WorkflowType string `json:"workflowType"`
StepName string `json:"stepName"`
Connector string `json:"connector"`
Action string `json:"action"`
Status string `json:"status"`
Timestamp time.Time `json:"timestamp"`
Duration time.Duration `json:"duration,omitempty"`
Data map[string]interface{} `json:"data,omitempty"`
Error string `json:"error,omitempty"`
Results map[string]interface{} `json:"results,omitempty"`
}
StepLifecycleEvent is the payload published for step-level lifecycle events.
type TestHelper ¶
type TestHelper struct {
// contains filtered or unexported fields
}
TestHelper provides utilities for module tests
func NewTestHelper ¶
func NewTestHelper(app modular.Application) *TestHelper
NewTestHelper creates a new test helper
type TestLogger ¶
type TestLogger struct {
Entries []string
}
TestLogger is a simple logger for testing
func NewTestApplication ¶
func NewTestApplication() (modular.Application, *TestLogger)
NewTestApplication creates an isolated test application
func (*TestLogger) Debug ¶
func (l *TestLogger) Debug(msg string, args ...interface{})
func (*TestLogger) Error ¶
func (l *TestLogger) Error(msg string, args ...interface{})
func (*TestLogger) Fatal ¶
func (l *TestLogger) Fatal(msg string, args ...interface{})
func (*TestLogger) Info ¶
func (l *TestLogger) Info(msg string, args ...interface{})
func (*TestLogger) Warn ¶
func (l *TestLogger) Warn(msg string, args ...interface{})
type TransformOperation ¶
type TransformOperation struct {
Type string `json:"type" yaml:"type"` // "extract", "map", "convert", "filter"
Config map[string]interface{} `json:"config" yaml:"config"`
}
TransformOperation defines a single transformation step
type TransformPipeline ¶
type TransformPipeline struct {
Name string `json:"name" yaml:"name"`
Operations []TransformOperation `json:"operations" yaml:"operations"`
}
TransformPipeline is a named sequence of operations
type Transition ¶
type Transition struct {
Name string `json:"name" yaml:"name"`
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]interface{} `json:"data,omitempty" yaml:"data,omitempty"`
}
Transition defines a possible state transition
type TransitionEvent ¶
type TransitionEvent struct {
WorkflowID string `json:"workflowId"`
TransitionID string `json:"transitionId"`
FromState string `json:"fromState"`
ToState string `json:"toState"`
Timestamp time.Time `json:"timestamp"`
Data map[string]interface{} `json:"data,omitempty"`
}
TransitionEvent represents a state transition event
func (TransitionEvent) InstanceID ¶
func (e TransitionEvent) InstanceID() string
InstanceID returns the workflow instance ID This method is provided for backward compatibility with code that expects an InstanceID field
type TransitionHandler ¶
type TransitionHandler interface {
HandleTransition(ctx context.Context, event TransitionEvent) error
}
TransitionHandler handles workflow state transitions
type TransitionListener ¶
type TransitionListener func(event TransitionEvent)
TransitionListener is a function that gets called when a transition occurs
type TransitionTrigger ¶
type Trigger ¶
type Trigger interface {
modular.Module
modular.Startable
modular.Stoppable
// Configure sets up the trigger from configuration
Configure(app modular.Application, triggerConfig interface{}) error
}
Trigger defines what can start a workflow execution
type TriggerRegistry ¶
type TriggerRegistry struct {
// contains filtered or unexported fields
}
TriggerRegistry manages registered triggers and allows finding them by name
func NewTriggerRegistry ¶
func NewTriggerRegistry() *TriggerRegistry
NewTriggerRegistry creates a new trigger registry
func (*TriggerRegistry) GetAllTriggers ¶
func (r *TriggerRegistry) GetAllTriggers() map[string]Trigger
GetAllTriggers returns all registered triggers
func (*TriggerRegistry) GetTrigger ¶
func (r *TriggerRegistry) GetTrigger(name string) (Trigger, bool)
GetTrigger returns a trigger by name
func (*TriggerRegistry) RegisterTrigger ¶
func (r *TriggerRegistry) RegisterTrigger(trigger Trigger)
RegisterTrigger adds a trigger to the registry
type TriggerWorkflower ¶
type TriggerWorkflower interface {
TriggerWorkflow(ctx context.Context, workflowType string, action string, data map[string]interface{}) error
}
TriggerWorkflower is the subset of the engine interface needed for routing.
type User ¶
type User struct {
ID string `json:"id"`
Email string `json:"email"`
Name string `json:"name"`
PasswordHash string `json:"-"`
CreatedAt time.Time `json:"createdAt"`
}
User represents a user in the in-memory store
type ValidatingNamespace ¶
type ValidatingNamespace struct {
// contains filtered or unexported fields
}
ValidatingNamespace adds validation to any namespace provider
func WithValidation ¶
func WithValidation(base ModuleNamespaceProvider) *ValidatingNamespace
WithValidation creates a validating namespace wrapper around any namespace provider
func (*ValidatingNamespace) FormatName ¶
func (vn *ValidatingNamespace) FormatName(baseName string) string
FormatName formats and validates a module name
func (*ValidatingNamespace) ResolveDependency ¶
func (vn *ValidatingNamespace) ResolveDependency(dependencyName string) string
ResolveDependency formats and validates a dependency name
func (*ValidatingNamespace) ResolveServiceName ¶
func (vn *ValidatingNamespace) ResolveServiceName(serviceName string) string
ResolveServiceName formats and validates a service name
func (*ValidatingNamespace) ValidateModuleName ¶
func (vn *ValidatingNamespace) ValidateModuleName(moduleName string) error
ValidateModuleName validates a module name
type WebhookConfig ¶
type WebhookConfig struct {
MaxRetries int `json:"maxRetries" yaml:"maxRetries"`
InitialBackoff time.Duration `json:"initialBackoff" yaml:"initialBackoff"`
MaxBackoff time.Duration `json:"maxBackoff" yaml:"maxBackoff"`
BackoffMultiplier float64 `json:"backoffMultiplier" yaml:"backoffMultiplier"`
Timeout time.Duration `json:"timeout" yaml:"timeout"`
}
WebhookConfig holds configuration for the webhook sender
type WebhookDelivery ¶
type WebhookDelivery struct {
ID string `json:"id"`
URL string `json:"url"`
Payload []byte `json:"payload"`
Headers map[string]string `json:"headers"`
Status string `json:"status"` // "pending", "delivered", "failed", "dead_letter"
Attempts int `json:"attempts"`
LastError string `json:"lastError,omitempty"`
CreatedAt time.Time `json:"createdAt"`
DeliveredAt *time.Time `json:"deliveredAt,omitempty"`
}
WebhookDelivery tracks a webhook delivery attempt
type WebhookIntegrationConnector ¶
type WebhookIntegrationConnector struct {
// contains filtered or unexported fields
}
WebhookIntegrationConnector implements a connector that receives webhook callbacks
func NewWebhookIntegrationConnector ¶
func NewWebhookIntegrationConnector(name, path string, port int) *WebhookIntegrationConnector
NewWebhookIntegrationConnector creates a new webhook integration connector
func (*WebhookIntegrationConnector) Connect ¶
func (c *WebhookIntegrationConnector) Connect(ctx context.Context) error
Connect establishes the webhook server
func (*WebhookIntegrationConnector) Disconnect ¶
func (c *WebhookIntegrationConnector) Disconnect(ctx context.Context) error
Disconnect stops the webhook server
func (*WebhookIntegrationConnector) Execute ¶
func (c *WebhookIntegrationConnector) Execute(ctx context.Context, action string, params map[string]interface{}) (map[string]interface{}, error)
Execute is a no-op for webhook connectors (they are passive)
func (*WebhookIntegrationConnector) GetName ¶
func (c *WebhookIntegrationConnector) GetName() string
GetName returns the connector name
func (*WebhookIntegrationConnector) IsConnected ¶
func (c *WebhookIntegrationConnector) IsConnected() bool
IsConnected checks if the connector is connected
func (*WebhookIntegrationConnector) RegisterEventHandler ¶
func (c *WebhookIntegrationConnector) RegisterEventHandler(eventType string, handler func(context.Context, map[string]interface{}) error)
RegisterEventHandler registers a handler for a specific event type
type WebhookSender ¶
type WebhookSender struct {
// contains filtered or unexported fields
}
WebhookSender sends webhooks with retry logic
func NewWebhookSender ¶
func NewWebhookSender(name string, config WebhookConfig) *WebhookSender
NewWebhookSender creates a new WebhookSender with sensible defaults
func (*WebhookSender) GetDeadLetters ¶
func (ws *WebhookSender) GetDeadLetters() []*WebhookDelivery
GetDeadLetters returns all dead letter deliveries
func (*WebhookSender) Init ¶
func (ws *WebhookSender) Init(app modular.Application) error
Init registers the webhook sender as a service
func (*WebhookSender) RetryDeadLetter ¶
func (ws *WebhookSender) RetryDeadLetter(ctx context.Context, id string) (*WebhookDelivery, error)
RetryDeadLetter retries a dead letter delivery
func (*WebhookSender) Send ¶
func (ws *WebhookSender) Send(ctx context.Context, url string, payload []byte, headers map[string]string) (*WebhookDelivery, error)
Send sends a webhook with retry logic
func (*WebhookSender) SetClient ¶
func (ws *WebhookSender) SetClient(client *http.Client)
SetClient sets a custom HTTP client (useful for testing)
type WorkflowDatabase ¶
type WorkflowDatabase struct {
// contains filtered or unexported fields
}
WorkflowDatabase wraps database/sql for workflow use
func NewWorkflowDatabase ¶
func NewWorkflowDatabase(name string, config DatabaseConfig) *WorkflowDatabase
NewWorkflowDatabase creates a new WorkflowDatabase module
func (*WorkflowDatabase) Close ¶
func (w *WorkflowDatabase) Close() error
Close closes the database connection
func (*WorkflowDatabase) DB ¶
func (w *WorkflowDatabase) DB() *sql.DB
DB returns the underlying *sql.DB
func (*WorkflowDatabase) DeleteRows ¶
func (w *WorkflowDatabase) DeleteRows(ctx context.Context, table string, where string, whereArgs ...interface{}) (int64, error)
DeleteRows builds and executes a DELETE statement
func (*WorkflowDatabase) Execute ¶
func (w *WorkflowDatabase) Execute(ctx context.Context, sqlStr string, args ...interface{}) (int64, error)
Execute executes a statement and returns rows affected
func (*WorkflowDatabase) Init ¶
func (w *WorkflowDatabase) Init(app modular.Application) error
Init registers the database as a service
func (*WorkflowDatabase) InsertRow ¶
func (w *WorkflowDatabase) InsertRow(ctx context.Context, table string, data map[string]interface{}) (int64, error)
InsertRow builds and executes an INSERT statement
func (*WorkflowDatabase) Name ¶
func (w *WorkflowDatabase) Name() string
Name returns the module name
func (*WorkflowDatabase) Open ¶
func (w *WorkflowDatabase) Open() (*sql.DB, error)
Open opens the database connection using config
func (*WorkflowDatabase) Ping ¶
func (w *WorkflowDatabase) Ping(ctx context.Context) error
Ping checks the database connection
func (*WorkflowDatabase) Query ¶
func (w *WorkflowDatabase) Query(ctx context.Context, sqlStr string, args ...interface{}) (*QueryResult, error)
Query executes a query and returns structured results
func (*WorkflowDatabase) UpdateRows ¶
func (w *WorkflowDatabase) UpdateRows(ctx context.Context, table string, data map[string]interface{}, where string, whereArgs ...interface{}) (int64, error)
UpdateRows builds and executes an UPDATE statement
type WorkflowEngine ¶
type WorkflowEngine interface {
TriggerWorkflow(ctx context.Context, workflowType string, action string, data map[string]interface{}) error
}
WorkflowEngine defines the interface for triggering workflows
type WorkflowEventEmitter ¶
type WorkflowEventEmitter struct {
// contains filtered or unexported fields
}
WorkflowEventEmitter publishes workflow and step lifecycle events to the EventBus. All methods are safe to call when the EventBus is unavailable (nil); they silently become no-ops.
func NewWorkflowEventEmitter ¶
func NewWorkflowEventEmitter(app modular.Application) *WorkflowEventEmitter
NewWorkflowEventEmitter creates a new emitter. It attempts to resolve the "eventbus.provider" service from the application. If the service is unavailable the emitter still works but all Emit* calls are no-ops.
func (*WorkflowEventEmitter) EmitStepCompleted ¶
func (e *WorkflowEventEmitter) EmitStepCompleted(ctx context.Context, workflowType, stepName, connector, action string, duration time.Duration, results map[string]interface{})
EmitStepCompleted publishes a "completed" lifecycle event for a workflow step.
func (*WorkflowEventEmitter) EmitStepFailed ¶
func (e *WorkflowEventEmitter) EmitStepFailed(ctx context.Context, workflowType, stepName, connector, action string, duration time.Duration, err error)
EmitStepFailed publishes a "failed" lifecycle event for a workflow step.
func (*WorkflowEventEmitter) EmitStepStarted ¶
func (e *WorkflowEventEmitter) EmitStepStarted(ctx context.Context, workflowType, stepName, connector, action string)
EmitStepStarted publishes a "started" lifecycle event for a workflow step.
func (*WorkflowEventEmitter) EmitWorkflowCompleted ¶
func (e *WorkflowEventEmitter) EmitWorkflowCompleted(ctx context.Context, workflowType, action string, duration time.Duration, results map[string]interface{})
EmitWorkflowCompleted publishes a "completed" lifecycle event for a workflow.
func (*WorkflowEventEmitter) EmitWorkflowFailed ¶
func (e *WorkflowEventEmitter) EmitWorkflowFailed(ctx context.Context, workflowType, action string, duration time.Duration, err error)
EmitWorkflowFailed publishes a "failed" lifecycle event for a workflow.
func (*WorkflowEventEmitter) EmitWorkflowStarted ¶
func (e *WorkflowEventEmitter) EmitWorkflowStarted(ctx context.Context, workflowType, action string, data map[string]interface{})
EmitWorkflowStarted publishes a "started" lifecycle event for a workflow.
type WorkflowInstance ¶
type WorkflowInstance struct {
ID string `json:"id"`
WorkflowType string `json:"workflowType"`
CurrentState string `json:"currentState"`
PreviousState string `json:"previousState"`
Data map[string]interface{} `json:"data"`
StartTime time.Time `json:"startTime"`
LastUpdated time.Time `json:"lastUpdated"`
Completed bool `json:"completed"`
Error string `json:"error,omitempty"`
}
WorkflowInstance represents an instance of a state machine workflow
type WorkflowLifecycleEvent ¶
type WorkflowLifecycleEvent struct {
WorkflowType string `json:"workflowType"`
Action string `json:"action"`
Status string `json:"status"`
Timestamp time.Time `json:"timestamp"`
Duration time.Duration `json:"duration,omitempty"`
Data map[string]interface{} `json:"data,omitempty"`
Error string `json:"error,omitempty"`
Results map[string]interface{} `json:"results,omitempty"`
}
WorkflowLifecycleEvent is the payload published for workflow-level lifecycle events.
type WorkflowTriggerInfo ¶
WorkflowTriggerInfo captures information about a workflow that was triggered
type WorkflowUIHandler ¶
type WorkflowUIHandler struct {
// contains filtered or unexported fields
}
WorkflowUIHandler serves the workflow editor UI and provides API endpoints for managing workflow configurations.
func NewWorkflowUIHandler ¶
func NewWorkflowUIHandler(cfg *config.WorkflowConfig) *WorkflowUIHandler
NewWorkflowUIHandler creates a new handler with an optional initial config.
func (*WorkflowUIHandler) RegisterRoutes ¶
func (h *WorkflowUIHandler) RegisterRoutes(mux *http.ServeMux)
RegisterRoutes registers all workflow UI routes on the given mux.
func (*WorkflowUIHandler) SetReloadFunc ¶
func (h *WorkflowUIHandler) SetReloadFunc(fn func(*config.WorkflowConfig) error)
SetReloadFunc sets the callback for reloading the engine with new config.
func (*WorkflowUIHandler) SetStatusFunc ¶
func (h *WorkflowUIHandler) SetStatusFunc(fn func() map[string]interface{})
SetStatusFunc sets the callback for getting engine status.
Source Files
¶
- api_handlers.go
- api_workflow_ui.go
- auth_middleware.go
- cross_workflow_router.go
- data_transformer.go
- database.go
- event_processor.go
- event_processor_service.go
- event_trigger.go
- eventbus_bridge.go
- eventbus_trigger.go
- health.go
- http.go
- http_handlers.go
- http_middleware.go
- http_router.go
- http_server.go
- http_trigger.go
- integration.go
- jwt_auth.go
- kafka_broker.go
- memory_broker.go
- message_handlers.go
- messaging.go
- metrics.go
- module_test_helpers.go
- namespace.go
- nats_broker.go
- otel_tracing.go
- request_id.go
- s3_storage.go
- schedule_trigger.go
- scheduler.go
- scheduler_test_helpers.go
- service_registry.go
- slack_notification.go
- state_connector.go
- state_machine.go
- state_tracker.go
- static_fileserver.go
- testutil.go
- trigger.go
- trigger_test_helpers.go
- webhook_sender.go
- workflow_events.go