Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventDefinition ¶
type EventDefinition struct { Providers []*ProviderDefinition `yaml:"messageProviders,omitempty"` EventDestinations []*EventNode `yaml:"eventDestinations,omitempty"` }
EventDefinition contains providers, event sources, and event destinations.
type EventNode ¶
type EventNode struct { Name string `yaml:"name"` Topic string `yaml:"topic"` ProviderRef string `yaml:"providerRef"` }
EventNode represents either an event source or destination and consists of a provider reference and the topic to either send to or receive from.
type Provider ¶
type Provider interface { // Send a new message to an eventDestination. // The first parameter is message body. The second parameter is optional header or context Send(*EventNode, []byte, interface{}) error // Subscribe to eventDefinition from an eventSource. Subscribe(*EventNode) error // Receive a message from an eventSource. The timeout can be configured by setting the timeout (in seconds) on the messageProvider. Receive(*EventNode) ([]byte, error) // Listen for eventDefinition on an eventSource and calls the specified ReceiverFunc on the event payload. ListenAndServe(*EventNode, ReceiverFunc) }
Provider must be implemented for whichever messaging provider to be supported.
type ProviderDefinition ¶
type ProviderDefinition struct { Name string `yaml:"name"` ProviderType string `yaml:"providerType"` URL string `yaml:"url"` Timeout time.Duration `yaml:"timeout"` SkipTLSVerify bool `yaml:"skipTLSVerify,omitempty"` }
ProviderDefinition describes a message provider and its URLs.
type ReceiverFunc ¶
type ReceiverFunc func([]byte)
ReceiverFunc is called when an event is received from an event source.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service contains the event definition and registered providers.
func NewService ¶
NewService initializes the message providers, and event sources and destinations.
func (*Service) GetEventDefinition ¶
func (s *Service) GetEventDefinition() *EventDefinition
GetEventDefinition returns the structure for eventDefinitions.yaml.
func (*Service) GetProvider ¶
GetProvider returns the provider with the name `name`.