Documentation
¶
Overview ¶
Package module defines core interfaces for the workflow engine
Index ¶
- Constants
- func CreateIsolatedApp(t *testing.T) modular.Application
- func SkipTestWithContext(ctx context.Context, skip bool) context.Context
- 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 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 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 Job
- 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 MockApplication
- func (a *MockApplication) ConfigProvider() modular.ConfigProvider
- func (a *MockApplication) ConfigSections() map[string]modular.ConfigProvider
- func (a *MockApplication) GetConfig() map[string]interface{}
- func (a *MockApplication) GetConfigSection(section string) (modular.ConfigProvider, error)
- func (a *MockApplication) GetService(name string, out interface{}) error
- func (a *MockApplication) Init() error
- func (a *MockApplication) IsVerboseConfig() bool
- func (a *MockApplication) Logger() modular.Logger
- 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) 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 PatternMatch
- 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) 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 ResourceStateMapping
- type Route
- 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 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) 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 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 TestHelper
- type TestLogger
- type Transition
- type TransitionEvent
- type TransitionHandler
- type TransitionListener
- type TransitionTrigger
- type Trigger
- type TriggerRegistry
- type ValidatingNamespace
- 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 WorkflowEngine
- type WorkflowInstance
- type WorkflowTriggerInfo
Constants ¶
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 CreateIsolatedApp ¶
func CreateIsolatedApp(t *testing.T) modular.Application
CreateIsolatedApp creates an isolated application for tests
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 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 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 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 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) GetConfig ¶
func (a *MockApplication) GetConfig() map[string]interface{}
func (*MockApplication) GetConfigSection ¶
func (a *MockApplication) GetConfigSection(section string) (modular.ConfigProvider, error)
func (*MockApplication) GetService ¶
func (a *MockApplication) GetService(name string, out interface{}) error
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) 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) 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 PatternMatch ¶
type PatternMatch struct { PatternID string `json:"patternId"` Events []EventData `json:"events"` MatchedTime time.Time `json:"matchedTime"` }
PatternMatch represents a successful pattern match
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
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 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 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 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) 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 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 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 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 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 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 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 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 WorkflowTriggerInfo ¶
WorkflowTriggerInfo captures information about a workflow that was triggered
Source Files
¶
- api_handlers.go
- auth_middleware.go
- event_processor.go
- event_processor_service.go
- event_trigger.go
- http.go
- http_handlers.go
- http_middleware.go
- http_router.go
- http_server.go
- http_trigger.go
- integration.go
- memory_broker.go
- message_handlers.go
- messaging.go
- module_test_helpers.go
- namespace.go
- schedule_trigger.go
- scheduler.go
- scheduler_test_helpers.go
- service_registry.go
- state_connector.go
- state_machine.go
- state_tracker.go
- testutil.go
- trigger.go
- trigger_test_helpers.go