pkg: Index | Files | Directories

package reactor

import ""


Package Files

api.go default.go

type Callback Uses

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

Callback function for asynchronous event handling.

type Handler Uses

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

Handler describes a command handler

type HandlerFunc Uses

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

HandlerFunc describes a function implementation.

func (HandlerFunc) Handle Uses

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

Handle call the wrapped function

type Reactor Uses

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 Uses

func New(name string) Reactor

New instantiate a default reactor instance.



Package reactor imports 5 packages (graph). Updated 2020-06-10. Refresh now. Tools for package owners.