reactor

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback func(context.Context, interface{}, error)

Callback function for asynchronous event handling.

type Handler

type Handler interface {
	Handle(ctx context.Context, req interface{}) (interface{}, error)
}

Handler describes a command handler

type HandlerFunc

type HandlerFunc func(context.Context, interface{}) (interface{}, error)

HandlerFunc describes a function implementation.

func (HandlerFunc) Handle

func (f HandlerFunc) Handle(ctx context.Context, req interface{}) (interface{}, error)

Handle call the wrapped function

type Reactor

type Reactor interface {
	// Send the reques to the reactor as an asynchronous call.
	Send(ctx context.Context, req interface{}, cb Callback) error
	// Do the request as a synchronous call.
	Do(ctx context.Context, req interface{}) (interface{}, error)
	// Register a message type handler
	RegisterHandler(msg interface{}, fn Handler)
}

Reactor defines reactor contract.

func New

func New(name string) Reactor

New instantiate a default reactor instance.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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