subscriptionsource

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultFetchInterval is the time to wait between trying to pull subscription updates
	// from Keptn's control plane.
	DefaultFetchInterval = time.Second * 5
	// DefaultMaxPingAttempts is the default number of times we try to contact Keptn's control plane
	// for renewing the registration.
	DefaultMaxPingAttempts = 10
	// DefaultPingAttemptsInterval is the default wait time between subsequent tries to contact Keptn's control plane
	// for renewing the registration.
	DefaultPingAttemptsInterval = time.Second * 3
)

Variables

View Source
var ErrMaxPingRetriesExceeded = errors.New("maximum retries for polling event api exceeded")

ErrMaxPingRetriesExceeded is used when the subscription source was not able to contact Keptn's control plane for a certain amount of attempts

Functions

func WithFetchInterval

func WithFetchInterval(interval time.Duration) func(s *UniformSubscriptionSource)

WithFetchInterval specifies the interval the subscription source should use when polling for new subscriptions

func WithFixedSubscriptions

func WithFixedSubscriptions(subscriptions ...models.EventSubscription) func(s *FixedSubscriptionSource)

WithFixedSubscriptions adds a fixed list of subscriptions to the FixedSubscriptionSource

func WithLogger

func WithLogger(logger logger.Logger) func(s *UniformSubscriptionSource)

WithLogger sets the logger to use

func WithMaxPingAttempts

func WithMaxPingAttempts(maxPingAttempts uint) func(s *UniformSubscriptionSource)

WithMaxPingAttempts sets the max number of attempts of retrying to ping Keptn's control plane for renewing the registration

func WithPingAttemptsInterval

func WithPingAttemptsInterval(duration time.Duration) func(s *UniformSubscriptionSource)

WithPingAttemptsInterval sets the time between subsequent tries to ping Keptn's control plane for renewing the registration

Types

type FixedSubscriptionSource

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

FixedSubscriptionSource can be used to use a fixed list of subscriptions rather than consulting the Keptn API for subscriptions. This is useful when you want to consume events from an event source, but NOT register as an Keptn integration to the control plane

func NewFixedSubscriptionSource

func NewFixedSubscriptionSource(options ...func(source *FixedSubscriptionSource)) *FixedSubscriptionSource

NewFixedSubscriptionSource creates a new instance of FixedSubscriptionSource

func (FixedSubscriptionSource) Register

func (s FixedSubscriptionSource) Register(integration models.Integration) (string, error)

func (FixedSubscriptionSource) Start

func (FixedSubscriptionSource) Stop

func (s FixedSubscriptionSource) Stop() error

type SubscriptionSource

type SubscriptionSource interface {
	Start(context.Context, types.RegistrationData, chan []models.EventSubscription, chan error, *sync.WaitGroup) error
	Register(integration models.Integration) (string, error)
	Stop() error
}

type UniformSubscriptionSource

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

UniformSubscriptionSource represents a source for uniform subscriptions

func New

func New(uniformAPI api.UniformV1Interface, options ...func(source *UniformSubscriptionSource)) *UniformSubscriptionSource

New creates a new UniformSubscriptionSource

func (*UniformSubscriptionSource) Register

func (s *UniformSubscriptionSource) Register(integration models.Integration) (string, error)

func (*UniformSubscriptionSource) Start

func (s *UniformSubscriptionSource) Start(ctx context.Context, registrationData types.RegistrationData, subscriptionChannel chan []models.EventSubscription, errC chan error, wg *sync.WaitGroup) error

Start triggers the execution of the UniformSubscriptionSource

func (*UniformSubscriptionSource) Stop

func (s *UniformSubscriptionSource) Stop() error

Jump to

Keyboard shortcuts

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