options

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudEventsAgentOptions

type CloudEventsAgentOptions struct {
	// CloudEventsOptions provides cloudevents clients to send/receive cloudevents based on different event protocol.
	CloudEventsOptions CloudEventsOptions

	// AgentID is a unique identifier for an agent, for example, it can consist of a managed cluster name and an agent
	// name.
	AgentID string

	// ClusterName is the name of a managed cluster on which the agent runs.
	ClusterName string

	// EventRateLimit limits the event sending rate.
	EventRateLimit EventRateLimit
}

CloudEventsAgentOptions provides the required options to build an agent CloudEventsClient

type CloudEventsOptions

type CloudEventsOptions interface {
	// WithContext returns back a new context with the given cloudevent context. The new context will be used when
	// sending a cloudevent.The new context is protocol-dependent, for example, for MQTT, the new context should contain
	// the MQTT topic, for Kafka, the context should contain the message key, etc.
	WithContext(ctx context.Context, evtContext cloudevents.EventContext) (context.Context, error)

	// Client returns a cloudevents client for sending and receiving cloudevents
	Client(ctx context.Context) (cloudevents.Client, error)

	// ErrorChan returns a chan which will receive the cloudevents connection error. The source/agent client will try to
	// reconnect the when this error occurs.
	ErrorChan() <-chan error
}

CloudEventsOptions provides cloudevents clients to send/receive cloudevents based on different event protocol.

Available implementations:

  • MQTT

type CloudEventsSourceOptions

type CloudEventsSourceOptions struct {
	// CloudEventsOptions provides cloudevents clients to send/receive cloudevents based on different event protocol.
	CloudEventsOptions CloudEventsOptions

	// SourceID is a unique identifier for a source, for example, it can generate a source ID by hashing the hub cluster
	// URL and appending the controller name. Similarly, a RESTful service can select a unique name or generate a unique
	// ID in the associated database for its source identification.
	SourceID string

	// EventRateLimit limits the event sending rate.
	EventRateLimit EventRateLimit
}

CloudEventsSourceOptions provides the required options to build a source CloudEventsClient

type EventRateLimit

type EventRateLimit struct {
	// QPS indicates the maximum QPS to send the event.
	// If it's less than or equal to zero, the DefaultQPS (50) will be used.
	QPS float32

	// Maximum burst for throttle.
	// If it's less than or equal to zero, the DefaultBurst (100) will be used.
	Burst int
}

EventRateLimit for limiting the event sending rate.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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