Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface {
Publisher
Subscriber
}
Backend combines all broker operations.
type Message ¶
type Message struct {
ID string
Event *event.CloudEvent
}
type Subscriber ¶
type Subscriber interface {
// Subscribe reads events from a topic using a consumer group.
// It first claims pending messages from dead consumers, then reads new messages.
// If eventTypes is non-empty, only events matching these CloudEvent types are returned.
//
// Error handling: infrastructure errors (e.g., Redis connection failure, consumer group
// creation failure) are terminal - the iterator stops after yielding the error.
// Message-level errors (e.g., unmarshal failure, missing fields) are non-terminal - the
// error is yielded but the iterator continues to the next message.
Subscribe(ctx context.Context, topic, consumerGroup, consumerName string, eventTypes []string) iter.Seq2[Message, error]
Ack(ctx context.Context, topic, consumerGroup string, messageIDs ...string) error
// DeleteConsumer removes a consumer from a consumer group.
// Should be called when a subscriber is done to avoid accumulating
// stale consumer entries in Redis.
DeleteConsumer(ctx context.Context, topic, consumerGroup, consumerName string) error
}
Click to show internal directories.
Click to hide internal directories.