publisher

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: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func NewPubSubTopic

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

NewPubSubTopic provides a pubsub topic from a PubSub client.

Types

type HttpMessageReceiver

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

HttpMessageReceiver is an interface to listen on http requests.

type PubSubPublisher

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

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

NewPublisher creates a new publisher.

func (*Publisher) Publish

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

Publish publishes an incoming event to a pubsub topic.

func (*Publisher) ServeHTTP

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

type TopicID string

Jump to

Keyboard shortcuts

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