messaging

package
v0.21.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 6, 2021 License: MIT Imports: 8 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMessageSizeLimit indicate that message is rejected by server due to size limitation
	ErrMessageSizeLimit = errors.New("message was too large, server rejected it to avoid allocation error")
)

Functions

This section is empty.

Types

type AckManager added in v0.18.0

type AckManager interface {
	// Read an item into backlog for processing for ack
	ReadItem(id int64) error
	// Get current max ID from read items
	GetReadLevel() int64
	// Set current max ID from read items
	SetReadLevel(readLevel int64)
	// Mark an item as done processing, and remove from backlog
	AckItem(id int64) (ackLevel int64)
	// Get current max level that can safely ack
	GetAckLevel() int64
	// Set current max level that can safely ack
	SetAckLevel(ackLevel int64)
	// GetBacklogCount return the of items that are waiting for ack
	GetBacklogCount() int64
}

AckManager convert out of order acks into ackLevel movement.

func NewAckManager added in v0.18.0

func NewAckManager(logger log.Logger) AckManager

NewAckManager returns a AckManager without monitoring the itemIDs continousness. For example, our internal matching task queue doesn't guarantee it.

func NewContinuousAckManager added in v0.18.0

func NewContinuousAckManager(logger log.Logger) AckManager

NewContinuousAckManager returns a ContinuousAckManager it will emit error logs for itemIDs being incontinuous This is useful for some message queue system that guarantees continuousness that we want to monitor it's behaving correctly

type Client

type Client interface {
	NewConsumer(appName, consumerName string) (Consumer, error)
	NewProducer(appName string) (Producer, error)
}

Client is the interface used to abstract out interaction with messaging system for replication

type CloseableProducer added in v0.9.3

type CloseableProducer interface {
	Producer
	Close() error
}

CloseableProducer is a Producer that can be closed

type Consumer added in v0.4.0

type Consumer interface {
	// Start starts the consumer
	Start() error
	// Stop stops the consumer
	Stop()
	// Messages return the message channel for this consumer
	Messages() <-chan Message
}

Consumer is the unified interface for both internal and external kafka clients

type Message added in v0.4.0

type Message interface {
	// Value is a mutable reference to the message's value
	Value() []byte
	// Partition is the ID of the partition from which the message was read.
	Partition() int32
	// Offset is the message's offset.
	Offset() int64
	// Ack marks the message as successfully processed.
	Ack() error
	// Nack marks the message processing as failed and the message will be retried or sent to DLQ.
	Nack() error
}

Message is the unified interface for a Kafka message

type Producer

type Producer interface {
	Publish(ctx context.Context, message interface{}) error
}

Producer is the interface used to send replication tasks to other clusters through replicator

func NewMetricProducer added in v0.5.0

func NewMetricProducer(
	producer Producer,
	metricsClient metrics.Client,
) Producer

NewMetricProducer creates a new instance of producer that emits metrics

func NewNoopProducer added in v0.15.0

func NewNoopProducer() Producer

NewNoopProducer returns a no-op message producer

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL