edge/pkg/bus/bus.go

14 lines
387 B
Go

package bus
import "context"
type Bus interface {
Subscribe(ctx context.Context, addr Address) (<-chan Envelope, error)
Unsubscribe(addr Address, ch <-chan Envelope)
Publish(env Envelope) error
Request(ctx context.Context, env Envelope) (Envelope, error)
Reply(ctx context.Context, addr Address, h RequestHandler) chan error
}
type RequestHandler func(env Envelope) (any, error)