go-api-boilerplate: github.com/vardius/go-api-boilerplate/pkg/commandbus Index | Files | Directories

package commandbus

import "github.com/vardius/go-api-boilerplate/pkg/commandbus"

Package commandbus provides interfaces along with helper functions

Index

Package Files

command_bus.go doc.go

type CommandBus Uses

type CommandBus interface {
    Publish(ctx context.Context, command domain.Command) error
    Subscribe(ctx context.Context, commandName string, fn CommandHandler) error
    Unsubscribe(ctx context.Context, commandName string) error
}

CommandBus allows to subscribe/dispatch commands Subscribing to the same command twice will unsubscribe previous handler command handler should be one to one

type CommandHandler Uses

type CommandHandler func(ctx context.Context, command domain.Command) error

CommandHandler function

Directories

PathSynopsis
memory

Package commandbus imports 2 packages (graph) and is imported by 8 packages. Updated 2020-12-06. Refresh now. Tools for package owners.