gcp

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBroker

func NewBroker(opts ...Option) broker.BrokerProvider

Types

type Broker

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

func (*Broker) GracefulStop

func (b *Broker) GracefulStop(ctx context.Context) error

func (*Broker) Init

func (b *Broker) Init(opts *broker.InitOptions)

func (Broker) Publish

func (b Broker) Publish(ctx context.Context, topicId string, msg *broker.Message) error

func (*Broker) Subscribe

func (b *Broker) Subscribe(ctx context.Context, topicId string, handler broker.SubscribeHandler) error

type Option

type Option func(*Options)

func ProjectID

func ProjectID(p string) Option

ProjectID is a required Google Pub/Sub project id

func SubscriptionPrefix

func SubscriptionPrefix(p string) Option

SubscriptionPrefix configures a prefix for all subs.

func TopicPrefix

func TopicPrefix(p string) Option

TopicPrefix configures a prefix for all topics in subscribers and publishers.

func WithCredentialsJSON

func WithCredentialsJSON(p []byte) Option

type Options

type Options struct {
	ProjectID          string
	TopicPrefix        string
	SubscriptionPrefix string
	CredentialsJSON    []byte
}

Jump to

Keyboard shortcuts

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