mirror of
https://github.com/go-kratos/kratos.git
synced 2025-01-24 03:46:37 +02:00
rename event
This commit is contained in:
parent
4f9319d1a6
commit
1ee3225155
@ -4,19 +4,15 @@ import (
|
||||
"context"
|
||||
)
|
||||
|
||||
// Message is an absctraction for all messages that
|
||||
// Event is an absctraction for all messages that
|
||||
// are sent to quque or received from queue.
|
||||
type Message struct {
|
||||
type Event struct {
|
||||
// Key sets the key of the message for routing policy
|
||||
Key string
|
||||
Value []byte
|
||||
Header map[string]string
|
||||
}
|
||||
|
||||
// Event given to a subscription handler for processing.
|
||||
type Event interface {
|
||||
Message() *Message
|
||||
Ack() error
|
||||
Nack() error
|
||||
// Payload for the message
|
||||
Payload []byte
|
||||
// Properties attach application defined properties on the message
|
||||
Properties map[string]string
|
||||
}
|
||||
|
||||
// Handler is a callback function that processes messages delivered
|
||||
@ -26,8 +22,8 @@ type Handler func(context.Context, Event) error
|
||||
// Publisher is absctraction for sending messages
|
||||
// to queue.
|
||||
type Publisher interface {
|
||||
Publish(ctx context.Context, msg *Message) error
|
||||
PublishAsync(ctx context.Context, msg *Message, callback func(err error)) error
|
||||
Publish(ctx context.Context, event Event) error
|
||||
PublishAsync(ctx context.Context, event Event, callback func(err error)) error
|
||||
Close() error
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user