You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kratos/events/pubsub.go

29 lines
402 B

package events
import (
"context"
"github.com/go-kratos/kratos/v2/transport"
)
type Handler interface {
Handle(ctx context.Context, msg Message) error
}
type Message struct {
Topic string
Data []byte
}
type PublishMetadata struct {
Topic string
}
type SubRequest struct {
Topic string
}
type Subscriber interface {
transport.Server
Subscribe(subReq SubRequest, handler Handler) error
}