options

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: Apache-2.0 Imports: 3 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)

	// Protocol returns a specific protocol to initialize the cloudevents client
	Protocol(ctx context.Context) (CloudEventsProtocol, 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
  • KAFKA
  • gRPC

type CloudEventsProtocol added in v0.14.0

type CloudEventsProtocol interface {
	protocol.Sender
	protocol.Receiver
	protocol.Closer
}

CloudEventsProtocol is a set of interfaces for a specific binding need to implemented Reference: https://cloudevents.github.io/sdk-go/protocol_implementations.html#protocol-interfaces

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
This is the dummy code to pass the compile when Kafka is not enabled.
This is the dummy code to pass the compile when Kafka is not enabled.

Jump to

Keyboard shortcuts

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