mirror of
https://github.com/go-kratos/kratos.git
synced 2025-01-26 03:52:12 +02:00
rename event
This commit is contained in:
parent
4f9319d1a6
commit
1ee3225155
@ -4,19 +4,15 @@ import (
|
|||||||
"context"
|
"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.
|
// 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
|
Key string
|
||||||
Value []byte
|
// Payload for the message
|
||||||
Header map[string]string
|
Payload []byte
|
||||||
}
|
// Properties attach application defined properties on the message
|
||||||
|
Properties map[string]string
|
||||||
// Event given to a subscription handler for processing.
|
|
||||||
type Event interface {
|
|
||||||
Message() *Message
|
|
||||||
Ack() error
|
|
||||||
Nack() error
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handler is a callback function that processes messages delivered
|
// 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
|
// Publisher is absctraction for sending messages
|
||||||
// to queue.
|
// to queue.
|
||||||
type Publisher interface {
|
type Publisher interface {
|
||||||
Publish(ctx context.Context, msg *Message) error
|
Publish(ctx context.Context, event Event) error
|
||||||
PublishAsync(ctx context.Context, msg *Message, callback func(err error)) error
|
PublishAsync(ctx context.Context, event Event, callback func(err error)) error
|
||||||
Close() error
|
Close() error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user