Versions in this module Expand all Collapse all v1 v1.0.1 Aug 23, 2026 v1.0.0 Aug 23, 2026 Changes in this version + const ContentTypeHeader + var ErrBatchResultCount = errors.New("source: batch handler returned wrong number of results") + var ErrDrained = errors.New("source: subscription drained") + var ErrInvalidForState = errors.New("source: event invalid for current state") + var ErrNoCodec = errors.New("source: no codec for message") + var ErrPoison = errors.New("source: poison message") + var ErrRetryable = errors.New("source: retryable error") + func DecodeTyped[T any](r *Registry, m Message) (T, error) + func Decoded(m Message) (any, bool) + type Action uint8 + const ActionAck + const ActionInProgress + const ActionManual + const ActionNak + const ActionTerm + func (a Action) String() string + type BatchHandler func(ctx context.Context, ms []Message) []Result + type Batched interface + NextBatch func(ctx context.Context, limit int) ([]Message, error) + SettleBatch func(ctx context.Context, ms []Message, r Result) error + type Classification uint8 + const Drop + const InvalidForState + const Poison + const Retryable + const Unclassified + func (c Classification) String() string + type Codec interface + Decode func(data []byte, h Headers) (any, error) + type CodecFunc func(data []byte, h Headers) (any, error) + func (f CodecFunc) Decode(data []byte, h Headers) (any, error) + type ConsumerGroups interface + GroupID func() string + OnAssigned func(func(ctx context.Context, assigned []Partition)) + OnRevoked func(func(ctx context.Context, revoked []Partition)) + type Cursor interface + String func() string + type DecodeError struct + ContentType string + Err error + Subject string + func (e *DecodeError) Error() string + func (e *DecodeError) Is(target error) bool + func (e *DecodeError) Unwrap() error + type Deduper interface + Seen func(ctx context.Context, key string) (bool, error) + type GuardRejection struct + Err error + Event string + State string + func (e *GuardRejection) Error() string + func (e *GuardRejection) Is(target error) bool + func (e *GuardRejection) Unwrap() error + type Handler func(ctx context.Context, m Message) Result + func Chain(h Handler, mw ...Middleware) Handler + type Header struct + Key string + Value string + type Headers []Header + func (h Headers) Get(key string) (string, bool) + func (h Headers) Keys() []string + type Hopper struct + func New(opts ...Option) *Hopper + func (hp *Hopper) Close() error + func (hp *Hopper) Receive(ctx context.Context, in Inlet, cfg SubscribeConfig, h Handler) error + func (hp *Hopper) ReceiveBatch(ctx context.Context, in Inlet, cfg SubscribeConfig, bh BatchHandler) error + func (hp *Hopper) Run(ctx context.Context, sub Subscription, h Handler) error + func (hp *Hopper) RunBatch(ctx context.Context, sub Subscription, bh BatchHandler) error + type Inlet interface + Close func() error + Subscribe func(ctx context.Context, cfg SubscribeConfig) (Subscription, error) + type JSONCodec struct + func NewJSONCodec[T any]() JSONCodec[T] + func (JSONCodec[T]) Decode(data []byte, _ Headers) (any, error) + type LagReporter interface + Lag func(ctx context.Context) (int64, error) + type Message interface + As func(target any) bool + Cursor func() Cursor + Headers func() Headers + Key func() []byte + PartitionKey func() string + Subject func() string + Value func() []byte + type Middleware func(Handler) Handler + type Option func(*config) + func WithBatch(size int, maxWait time.Duration) Option + func WithBatchClock(now func() time.Time) Option + func WithCodec(codec Codec) Option + func WithConcurrency(n int) Option + func WithLogger(l *slog.Logger) Option + func WithMaxInFlight(n int) Option + func WithMaxLanes(n int) Option + func WithMeter(m telemetry.Meter) Option + func WithMiddleware(mw ...Middleware) Option + func WithName(name string) Option + func WithRegistry(r *Registry) Option + func WithTracer(t telemetry.Tracer) Option + type OrderedDelivery interface + OrderedDelivery func() + type Partition struct + ID int32 + Topic string + type PartitionOrdered interface + PartitionOrdered func() + type Position interface + String func() string + type ProducedRecord struct + Headers Headers + Key []byte + Topic string + Value []byte + type Registry struct + func NewRegistry() *Registry + func (r *Registry) Decode(m Message) (any, error) + func (r *Registry) Register(contentType string, codec Codec) *Registry + func (r *Registry) SetDefault(codec Codec) *Registry + type Result struct + Action Action + Class Classification + Err error + Requeue time.Duration + func Ack() Result + func InProgress() Result + func Manual() Result + func Nak(err error) Result + func NakAfter(d time.Duration, err error) Result + func Reject(err error) Result + func Skip() Result + func Term(err error) Result + func (r Result) Failed() bool + type Seekable interface + SeekToCursor func(ctx context.Context, c Cursor) error + SeekToEnd func(ctx context.Context) error + SeekToStart func(ctx context.Context) error + SeekToTime func(ctx context.Context, t time.Time) error + type SharedDurable interface + Durable func() string + type SubscribeConfig struct + Group string + Topics []string + type Subscription interface + Close func() error + Next func(ctx context.Context) (Message, error) + Settle func(ctx context.Context, m Message, r Result) error + type Transactional interface + Begin func(ctx context.Context, m Message, fn func(ctx context.Context, tx Tx) error) error + type Tx interface + Produce func(ctx context.Context, records ...ProducedRecord) error