Messaging Interface Abstraction for Things-Kit
This module defines the messaging abstraction for Things-Kit applications. It contains only interfaces, no implementation.
go get github.com/things-kit/things-kit-messagingThe things-kit-messaging package defines the contracts for message handling in distributed systems. This allows applications to program against stable interfaces while being free to choose any messaging backend (Kafka, RabbitMQ, NATS, SQS, etc.).
type Message interface {
Topic() string
Key() []byte
Value() []byte
Headers() map[string]string
Timestamp() time.Time
}type Handler interface {
Handle(ctx context.Context, msg Message) error
Topic() string
}type Consumer interface {
RegisterHandler(handler Handler)
Start(ctx context.Context) error
Stop(ctx context.Context) error
}type Producer interface {
Produce(ctx context.Context, msg Message) error
Close() error
}The things-kit-kafka module provides a Kafka-based implementation.
MIT License - see LICENSE file for details