events

package
v0.9.17 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package events implements event publisher per baseplate spec.

This package is mainly just the serialization part. The actual publishing part is handled by sidecar implemented by baseplate.py, and communicated via mqsend package.

Index

Constants

View Source
const (
	// Max size in bytes for a single, serialized event.
	MaxEventSize = 102400

	// Max size of the events allowed in the message queue at one time.
	MaxQueueSize = 10000

	// Prefix added to the message queue name.
	QueueNamePrefix = "events-"

	// The default message queue name for v2 events.
	DefaultV2Name = "v2"
)

Configuration values for the message queue.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// The name of the message queue, should not contain the "events-" prefix.
	//
	// For v2 events, the default name (when passed in Name is empty) is "v2".
	Name string `yaml:"name"`

	// The max timeout applied to Put function.
	//
	// If the passed in context object already has an earlier deadline set,
	// that deadline will be respected instead.
	//
	// If MaxPutTimeout <= 0,
	// Put function would run in non-blocking mode,
	// that it fails immediately if the queue is full.
	MaxPutTimeout time.Duration `yaml:"maxPutTimeout"`

	// The max size of the message queue (number of messages).
	//
	// If it <=0 or > MaxQueueSize (the constant, 10000),
	// MaxQueueSize constant will be used instead.
	MaxQueueSize int64 `yaml:"maxQueueSize"`
}

The Config used to initialize an event queue.

Can be deserialized from YAML.

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

A Queue is an event queue.

func V2

func V2() (*Queue, error)

V2 initializes a new v2 event queue with default configurations.

func V2WithConfig

func V2WithConfig(cfg Config) (*Queue, error)

V2WithConfig initializes a new v2 event queue.

func (*Queue) Close

func (q *Queue) Close() error

Close closes the event queue.

After Close is called, all Put calls will return errors.

func (*Queue) Put

func (q *Queue) Put(ctx context.Context, event thrift.TStruct) error

Put serializes and puts an event into the event queue.

func (*Queue) PutRaw added in v0.9.10

func (q *Queue) PutRaw(ctx context.Context, rawEvent []byte) error

PutRaw puts a raw, already properly serialized event into the event queue.

In most cases you should use Put instead. This is only provided for some special cases like experiments-v2 custom exposers.

Jump to

Keyboard shortcuts

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