Documentation
¶
Index ¶
- Variables
- func ContextWithPropagation(ctx context.Context, fields map[string]string) context.Context
- func IsPermanent(err error) bool
- func Permanent(err error) error
- func PropagationFromContext(ctx context.Context) map[string]string
- type Backend
- type NoopEngine
- func (e *NoopEngine) Close() error
- func (e *NoopEngine) Publish(_ string, _ ...*message.Message) error
- func (e *NoopEngine) Publisher() message.Publisher
- func (e *NoopEngine) Shutdown(_ context.Context) error
- func (e *NoopEngine) Subscribe(ctx context.Context, _ string) (<-chan *message.Message, error)
- func (e *NoopEngine) Subscriber() message.Subscriber
- type Option
- func WithCloseTimeout(timeout time.Duration) Option
- func WithDeadLetterTopicSuffix(suffix string) Option
- func WithInitialBackoff(backoff time.Duration) Option
- func WithLogger(logger *slog.Logger) Option
- func WithMaxBackoff(backoff time.Duration) Option
- func WithMaxRetries(maxRetries int) Option
- func WithPublishMaxInflight(limit int) Option
- type Publisher
- type Router
- func (r *Router) Errors() <-chan error
- func (r *Router) Publish(ctx context.Context, topic string, id string, event []byte) error
- func (r *Router) Shutdown(ctx context.Context) error
- func (r *Router) Start(ctx context.Context) error
- func (r *Router) Subscribe(topic string, handler func(ctx context.Context, event []byte) error) error
- type Subscriber
- type TopicInitializer
Constants ¶
This section is empty.
Variables ¶
var ErrPublishCapacity = errors.New("publish capacity unavailable")
ErrPublishCapacity means waiting for an available publisher slot failed.
Functions ¶
func ContextWithPropagation ¶ added in v0.9.79
ContextWithPropagation restores correlation onto the consumer's context, retaining its local values, cancellation and deadline.
func IsPermanent ¶ added in v0.9.79
IsPermanent identifies invalid messages that retrying cannot repair.
Types ¶
type NoopEngine ¶
type NoopEngine struct{}
func NewNoop ¶
func NewNoop() *NoopEngine
func (*NoopEngine) Close ¶
func (e *NoopEngine) Close() error
func (*NoopEngine) Publisher ¶
func (e *NoopEngine) Publisher() message.Publisher
func (*NoopEngine) Subscriber ¶
func (e *NoopEngine) Subscriber() message.Subscriber
type Option ¶
type Option func(*Router)
func WithCloseTimeout ¶ added in v0.9.79
WithCloseTimeout sets how long shutdown waits for message handlers. Zero uses the default of 30 seconds.
func WithDeadLetterTopicSuffix ¶ added in v0.9.79
WithDeadLetterTopicSuffix sets the suffix appended to topics for failed messages.
func WithInitialBackoff ¶ added in v0.9.79
WithInitialBackoff sets the initial backoff interval for consumer retries.
func WithLogger ¶
func WithMaxBackoff ¶ added in v0.9.79
WithMaxBackoff sets the maximum backoff interval for consumer retries.
func WithMaxRetries ¶ added in v0.9.79
WithMaxRetries sets the number of consumer retries after the first attempt. Zero disables retries.
func WithPublishMaxInflight ¶ added in v0.9.79
WithPublishMaxInflight sets the maximum number of active broker calls shared by regular and dead-letter publishing. It must be positive and defaults to 32. Calls that outlive their context occupy capacity until the backend returns.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
func (*Router) Errors ¶ added in v0.9.79
Errors reports at most one unexpected termination after Start succeeds. It closes when the router stops; normal shutdown closes it without an error.