http

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2020 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GCPPublisher added in v0.2.1

type GCPPublisher struct {
	pubsub.Publisher
}

GCPPublisher publishes data in the same format as a GCP push-style payload.

func NewGCPStylePublisher

func NewGCPStylePublisher(url string, client *http.Client) GCPPublisher

NewGCPStylePublisher will return a pubsub.Publisher that wraps the payload in a GCP pubsub.Message-like object that will make this publisher emulate Google's PubSub posting messages to a server. If no http.Client is provided, the default one has a 5 second timeout.

func (GCPPublisher) Publish added in v0.2.1

func (p GCPPublisher) Publish(ctx context.Context, key string, msg proto.Message) error

Publish will serialize the given message and pass it to PublishRaw.

func (GCPPublisher) PublishMulti added in v0.2.1

func (p GCPPublisher) PublishMulti(ctx context.Context, keys []string, msgs []proto.Message) error

PublishMulti will serialize the given messages and pass them to PublishMultiRaw.

func (GCPPublisher) PublishMultiRaw added in v0.2.1

func (p GCPPublisher) PublishMultiRaw(ctx context.Context, _ []string, msgs [][]byte) error

PublishMultiRaw will call PublishRaw for each message given.

func (GCPPublisher) PublishRaw added in v0.2.1

func (p GCPPublisher) PublishRaw(ctx context.Context, key string, msg []byte) error

PublishRaw will wrap the given message in a struct similar to GCP's push-style PubSub subscriptions and then POST the message payload at the URL provided in the construct.

type Publisher added in v0.2.1

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

Publisher implements the pubsub.Publisher and MultiPublisher interfaces for use in a plain HTTP environment.

func NewPublisher

func NewPublisher(url string, client *http.Client) Publisher

NewPublisher will return a pubsub.Publisher that simply posts the payload to the given URL. If no http.Client is provided, the default one has a 5 second timeout.

func (Publisher) Publish added in v0.2.1

func (p Publisher) Publish(ctx context.Context, key string, msg proto.Message) error

Publish will serialize the given message and pass it to PublishRaw.

func (Publisher) PublishMulti added in v0.2.1

func (p Publisher) PublishMulti(ctx context.Context, keys []string, msgs []proto.Message) error

PublishMulti will serialize the given messages and pass them to PublishMultiRaw.

func (Publisher) PublishMultiRaw added in v0.2.1

func (p Publisher) PublishMultiRaw(ctx context.Context, _ []string, msgs [][]byte) error

PublishMultiRaw will call PublishRaw for each message given.

func (Publisher) PublishRaw added in v0.2.1

func (p Publisher) PublishRaw(_ context.Context, _ string, payload []byte) error

PublishRaw will POST the given message payload at the URL provided in the Publisher construct.

Jump to

Keyboard shortcuts

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