2023-02-09 12:16:36 +01:00
|
|
|
package bus
|
|
|
|
|
|
|
|
import "context"
|
|
|
|
|
|
|
|
type Bus interface {
|
2023-11-28 16:35:49 +01:00
|
|
|
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
|
2023-02-09 12:16:36 +01:00
|
|
|
}
|
|
|
|
|
2023-11-28 16:35:49 +01:00
|
|
|
type RequestHandler func(env Envelope) (any, error)
|