rename event

pull/804/head
Tony Chen 4 years ago committed by chenzhihui
parent 4f9319d1a6
commit 1ee3225155
  1. 24
      event/event.go

@ -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 {
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
type Event struct {
// Key sets the key of the message for routing policy
Key string
// 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…
Cancel
Save