14 lines
443 B
Go
14 lines
443 B
Go
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)
|