publisher

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: Apache-2.0 Imports: 20 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

PublisherSet provides a handler with a real HTTPMessageReceiver and a PubSub client.

Functions

func NewPubSubTopic added in v0.16.0

func NewPubSubTopic(ctx context.Context, client *pubsub.Client, topicID TopicID) *pubsub.Topic

NewPubSubTopic provides a pubsub topic from a PubSub client.

Types

type HttpMessageReceiver added in v0.16.0

type HttpMessageReceiver interface {
	StartListen(ctx context.Context, handler nethttp.Handler) error
}

HttpMessageReceiver is an interface to listen on http requests.

type PubSubPublisher added in v0.16.0

type PubSubPublisher interface {
	Publish(ctx context.Context, event cev2.Event) protocol.Result
}

PubSubPublisher is an interface to publish events to a pubsub topic.

type Publisher

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

Publisher receives HTTP events and sends them to Pubsub.

func NewPublisher added in v0.16.0

func NewPublisher(ctx context.Context, inbound HttpMessageReceiver, topic *pubsub.Topic, authType authcheck.AuthType) *Publisher

NewPublisher creates a new publisher.

func (*Publisher) Publish added in v0.16.0

func (p *Publisher) Publish(ctx context.Context, event *cev2.Event) protocol.Result

Publish publishes an incoming event to a pubsub topic.

func (*Publisher) ServeHTTP added in v0.16.0

func (p *Publisher) ServeHTTP(response nethttp.ResponseWriter, request *nethttp.Request)

ServeHTTP implements net/http Publisher interface method. 1. Performs basic validation of the request. 2. Converts the request to an event. 3. Sends the event to pubsub.

func (*Publisher) Start

func (p *Publisher) Start(ctx context.Context) error

Start blocks to receive events over HTTP.

type TopicID added in v0.16.0

type TopicID string

Jump to

Keyboard shortcuts

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