adapter

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: Apache-2.0 Imports: 26 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

AdapterSet provides an adapter with a PubSub client and HTTP client.

Functions

func NewPubSubSubscription added in v0.16.0

func NewPubSubSubscription(ctx context.Context, client *pubsub.Client, subscriptionID SubscriptionID) *pubsub.Subscription

Types

type Adapter

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

Adapter implements the Pub/Sub adapter to deliver Pub/Sub messages from a pre-existing topic/subscription to a Sink.

func NewAdapter added in v0.16.0

func NewAdapter(
	ctx context.Context,
	projectID clients.ProjectID,
	namespace Namespace,
	name Name,
	resourceGroup ResourceGroup,
	subscription *pubsub.Subscription,
	outbound *nethttp.Client,
	converter converters.Converter,
	reporter StatsReporter,
	args *AdapterArgs) *Adapter

NewAdapter creates a new adapter.

func (*Adapter) Start

func (a *Adapter) Start(ctx context.Context) error

func (*Adapter) Stop added in v0.16.0

func (a *Adapter) Stop()

Stop stops the adapter.

type AdapterArgs added in v0.16.0

type AdapterArgs struct {
	// TopicID is the id of the Pub/Sub topic.
	TopicID string

	// SinkURI is the URI where to sink events to.
	SinkURI string

	// TransformerURI is the URI for the transformer.
	// Used for channels.
	TransformerURI string

	// Extensions is the converted ExtensionsBased64 value.
	Extensions map[string]string

	// ConverterType use to select which converter to use.
	ConverterType converters.ConverterType

	// AuthType is the authentication configuration mode the Pod uses.
	AuthType authcheck.AuthType
}

AdapterArgs has a bundle of arguments needed to create an Adapter.

type Name added in v0.16.0

type Name string

TODO Name and ResourceGroup might cause problems in the near future, as we might use a single receive-adapter

for multiple source objects. Same with Namespace, when doing multi-tenancy.

type Namespace added in v0.16.0

type Namespace string

type ReportArgs added in v0.9.0

type ReportArgs struct {
	EventType   string
	EventSource string
}

type ResourceGroup added in v0.16.0

type ResourceGroup string

type SinkURI added in v0.16.0

type SinkURI string

type StatsReporter added in v0.9.0

type StatsReporter interface {
	// ReportEventCount captures the event count. It records one per call.
	ReportEventCount(args *ReportArgs, responseCode int) error
}

StatsReporter defines the interface for sending metrics.

func NewStatsReporter added in v0.9.0

func NewStatsReporter(name Name, namespace Namespace, resourceGroup ResourceGroup) (StatsReporter, error)

NewStatsReporter creates a reporter that collects and reports metrics.

type SubscriptionID added in v0.16.0

type SubscriptionID string

type TransformerURI added in v0.16.0

type TransformerURI string

Directories

Path Synopsis
Package converters contains pubsub message to cloudevent converters used by pubsub-based source.
Package converters contains pubsub message to cloudevent converters used by pubsub-based source.

Jump to

Keyboard shortcuts

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