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
441 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
Metadata map[string]interface{}
}
type PublishMetadata struct {
Topic string
}
type SubRequest struct {
Topic string
}
type Subscriber interface {
transport.Server
Subscribe(subReq SubRequest, handler Handler) error
}