Documentation ¶
Overview ¶
Package mesg is an application client for mesg-core. For more information please visit https://mesg.com.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
Application represents is a MESG application.
func New ¶
func New(options ...Option) (*Application, error)
New returns a new Application with options.
func (*Application) Close ¶
func (a *Application) Close() error
Close gracefully waits current events or results to complete their process and and closes underlying connections.
func (*Application) WhenEvent ¶
func (a *Application) WhenEvent(serviceID string, conditions ...EventCondition) *EventEmitter
WhenEvent creates an EventEmitter for serviceID.
func (*Application) WhenResult ¶
func (a *Application) WhenResult(serviceID string, conditions ...ResultCondition) *ResultEmitter
WhenResult creates a ResultEmitter for serviceID.
type Event ¶
type Event struct { Key string // contains filtered or unexported fields }
Event represents an event.
type EventCondition ¶
type EventCondition func(*EventEmitter)
EventCondition is the condition configurator for filtering events.
func EventKeyCondition ¶
func EventKeyCondition(event string) EventCondition
EventKeyCondition returns a new condition to filter events by name. Default is all(*).
type EventEmitter ¶
type EventEmitter struct {
// contains filtered or unexported fields
}
EventEmitter is a MESG event emitter.
func (*EventEmitter) Execute ¶
func (e *EventEmitter) Execute(serviceID, taskKey string) (*Listener, error)
Execute starts for listening events and executes task taskKey for serviceID with the output data of event or return value of Map if all Filter funcs returned as true.
func (*EventEmitter) Filter ¶
func (e *EventEmitter) Filter(fn func(*Event) (execute bool)) *EventEmitter
Filter sets filter funcs that will be executed to decide to execute the task or not. It's possible to add multiple filters by calling Filter multiple times. Other filter funcs and the task execution will no proceed if a filter func returns false.
type Listener ¶
type Listener struct { // Err filled when Listener fails to continue. Err chan error // contains filtered or unexported fields }
Listener is a task execution listener.
type Option ¶
type Option func(*Application)
Option is the configuration func of Application.
func DialOption ¶
DialOption used to mock socket communication for unit testing.
func EndpointOption ¶
EndpointOption receives the endpoint of MESG.
func LogOutputOption ¶
LogOutputOption uses out as a log destination.
type Result ¶
type Result struct { TaskKey string OutputKey string Tags []string // contains filtered or unexported fields }
Result represents a task result.
type ResultCondition ¶
type ResultCondition func(*ResultEmitter)
ResultCondition is the condition configurator for filtering results.
func OutputKeyCondition ¶
func OutputKeyCondition(outputKey string) ResultCondition
OutputKeyCondition returns a new option to filter results by outputKey. Default is all(*).
func TagsCondition ¶
func TagsCondition(executionTags ...string) ResultCondition
TagsCondition returns a new option to filter results by executionTags. This is a "match all" algorithm. All tags should be included in the execution to have a match.
func TaskKeyCondition ¶
func TaskKeyCondition(taskKey string) ResultCondition
TaskKeyCondition returns a new option to filter results by taskKey. Default is all(*).
type ResultEmitter ¶
type ResultEmitter struct {
// contains filtered or unexported fields
}
ResultEmitter is a MESG result event listener.
func (*ResultEmitter) Execute ¶
func (e *ResultEmitter) Execute(serviceID, taskKey string) (*Listener, error)
Execute starts for listening events and executes task taskKey for serviceID with the output data of result or return value of Map if all Filter funcs returned as true.
func (*ResultEmitter) Filter ¶
func (e *ResultEmitter) Filter(fn func(*Result) (execute bool)) *ResultEmitter
Filter sets filter funcs that will be executed to decide to execute the task or not. It's possible to add multiple filters by calling Filter multiple times. Other filter funcs and the task execution will no proceed if a filter func returns false.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
examples
|
|
quickstart/cmd
Package main is a quick-start application.
|
Package main is a quick-start application. |
Package mesgtest is a testing package for MESG application.
|
Package mesgtest is a testing package for MESG application. |