edge/pkg/bus/bus.go

14 lines
443 B
Go
Raw Permalink Normal View History

2023-02-09 12:16:36 +01:00
package bus
import "context"
type Bus interface {
Subscribe(ctx context.Context, ns MessageNamespace) (<-chan Message, error)
Unsubscribe(ctx context.Context, ns MessageNamespace, ch <-chan Message)
Publish(ctx context.Context, msg Message) error
Request(ctx context.Context, msg Message) (Message, error)
Reply(ctx context.Context, ns MessageNamespace, h RequestHandler) error
}
type RequestHandler func(msg Message) (Message, error)