events

package
v0.0.0-...-bde19ca Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2020 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 MaxPutTimeout to be used.
	DefaultMaxPutTimeout = time.Millisecond * 50

	// 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

	// 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, DefaultMaxPutTimeout will be used instead.
	MaxPutTimeout time.Duration
}

The Config used to initialize an event queue.

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.

Jump to

Keyboard shortcuts

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