adapter

package
v0.0.0-...-d19fc40 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func NewPubSubSubscription

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

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

func (a *Adapter) Stop()

Stop stops the adapter.

type AdapterArgs

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
}

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

type Name

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

type Namespace string

type ReportArgs

type ReportArgs struct {
	EventType   string
	EventSource string
}

type ResourceGroup

type ResourceGroup string

type SinkURI

type SinkURI string

type StatsReporter

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

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

NewStatsReporter creates a reporter that collects and reports metrics.

type SubscriptionID

type SubscriptionID string

type TransformerURI

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