gizmo: github.com/NYTimes/gizmo/pubsub/gcp Index | Files

package gcp

import "github.com/NYTimes/gizmo/pubsub/gcp"

Index

Package Files

config.go gcp.go gcp_http.go

func NewHTTPPublisher Uses

func NewHTTPPublisher(ctx context.Context, projID, topic string, src oauth2.TokenSource) (pubsub.MultiPublisher, error)

NewHTTPPublisher will instantiate a new GCP MultiPublisher that utilizes the HTTP client. This client is useful mainly for the App Engine standard environment as the gRPC client counts against the socket quota for some reason.

func NewPublisher Uses

func NewPublisher(ctx context.Context, cfg Config, opts ...option.ClientOption) (pubsub.MultiPublisher, error)

NewPublisher will instantiate a new GCP MultiPublisher.

type Config Uses

type Config struct {
    ProjectID string `envconfig:"GOOGLE_CLOUD_PROJECT"`

    // For publishing
    Topic string `envconfig:"GCP_PUBSUB_TOPIC"`
    // For subscribing
    Subscription string `envconfig:"GCP_PUBSUB_SUBSCRIPTION"`
}

Config holds common credentials and config values for working with GCP PubSub.

func LoadConfigFromEnv Uses

func LoadConfigFromEnv() Config

LoadConfigFromEnv will attempt to load a PubSub config from environment variables.

type SubMessage Uses

type SubMessage struct {
    Attributes map[string]string
    // contains filtered or unexported fields
}

SubMessage pubsub implementation of pubsub.SubscriberMessage.

func (*SubMessage) Done Uses

func (m *SubMessage) Done() error

Done will acknowledge the pubsub Message.

func (*SubMessage) ExtendDoneDeadline Uses

func (m *SubMessage) ExtendDoneDeadline(dur time.Duration) error

ExtendDoneDeadline will call the deprecated ModifyAckDeadline for a pubsub Message. This likely should not be called.

func (*SubMessage) Message Uses

func (m *SubMessage) Message() []byte

Message will return the data of the pubsub Message.

type Subscriber Uses

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

Subscriber is a Google Cloud Platform PubSub client that allows a user to consume messages via the pubsub.Subscriber interface.

func NewSubscriber Uses

func NewSubscriber(ctx context.Context, projID, subscription string, opts ...option.ClientOption) (*Subscriber, error)

NewSubscriber will instantiate a new Subscriber that wraps a pubsub.Iterator.

func (*Subscriber) Err Uses

func (s *Subscriber) Err() error

Err will contain any error the Subscriber has encountered while processing.

func (*Subscriber) SetReceiveSettings Uses

func (s *Subscriber) SetReceiveSettings(settings gpubsub.ReceiveSettings)

SetReceiveSettings sets the ReceivedSettings on the google pubsub Subscription. Should be called before Start().

func (*Subscriber) Start Uses

func (s *Subscriber) Start() <-chan pubsub.SubscriberMessage

Start will start pulling from pubsub via a pubsub.Iterator.

func (*Subscriber) Stop Uses

func (s *Subscriber) Stop() error

Stop will block until the consumer has stopped consuming messages.

Package gcp imports 13 packages (graph) and is imported by 1 packages. Updated 2019-03-06. Refresh now. Tools for package owners.