1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-03-27 21:49:08 +02:00

remove event interface (#923)

This commit is contained in:
Tony Chen 2021-05-17 20:54:54 +08:00 committed by GitHub
parent 0dbcaa2443
commit 2de0fa330c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 37 deletions

View File

@ -1,3 +0,0 @@
# Events
* [Kafka](https://github.com/go-kratos/kafka)

View File

@ -1,34 +0,0 @@
package event
import (
"context"
)
// Event is an absctraction for all messages that
// are sent to quque or received from queue.
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
// to asynchronous subscribers.
type Handler func(context.Context, Event) error
// Publisher is absctraction for sending messages
// to queue.
type Publisher interface {
Publish(ctx context.Context, event Event) error
Close() error
}
// Subscriber is an absctraction for receiving messages
// from queue.
type Subscriber interface {
Subscribe(ctx context.Context, h Handler) error
Close() error
}