pubsub

package
v1.95.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2022 License: MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(opts ...ClientOption) (*Client, error)

func (*Client) Close

func (client *Client) Close()

func (*Client) Topic

func (client *Client) Topic(name string) *Topic

type ClientOption

type ClientOption func(client *Client)

func DisableLocalEmulator

func DisableLocalEmulator() ClientOption

func WithProject

func WithProject(project string) ClientOption

type Handler added in v1.86.0

type Handler func(ctx context.Context, message *Message) error

type LocalSubscribeOption

type LocalSubscribeOption func(cnf *pubsub.SubscriptionConfig)

func WithFilter

func WithFilter(filter string) LocalSubscribeOption

type Message

type Message struct {
	ID         string            `json:"messageId"`
	Attributes map[string]string `json:"attributes"`

	RawData []byte `json:"data"`
}

func (*Message) ReadJSON

func (msg *Message) ReadJSON(dest interface{}) error

func (*Message) ReadProto

func (msg *Message) ReadProto(dest proto.Message) error

type PublishOption

type PublishOption func(msg *pubsub.Message)

func WithAttribute

func WithAttribute(key, value string) PublishOption

type PushRequest

type PushRequest struct {
	Subscription string   `json:"subscription"`
	Message      *Message `json:"message"`
}

type Server added in v1.86.0

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

func NewServer added in v1.86.0

func NewServer(r *hosting.WebServer, opts ...ServerOption) (*Server, error)

func (*Server) Subscribe added in v1.86.0

func (s *Server) Subscribe(subscription string, handler Handler)

type ServerOption added in v1.86.0

type ServerOption func(s *Server)

func WithAudience added in v1.86.0

func WithAudience(audience string) ServerOption

func WithServiceAccount added in v1.86.0

func WithServiceAccount(serviceAccount string) ServerOption

type Topic

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

func (*Topic) LocalAssertSubscription

func (topic *Topic) LocalAssertSubscription(ctx context.Context, name string, opts ...LocalSubscribeOption) error

func (*Topic) PublishBytes

func (topic *Topic) PublishBytes(ctx context.Context, value []byte, opts ...PublishOption) error

func (*Topic) PublishJSON

func (topic *Topic) PublishJSON(ctx context.Context, value interface{}, opts ...PublishOption) error

func (*Topic) PublishProto

func (topic *Topic) PublishProto(ctx context.Context, data proto.Message, opts ...PublishOption) error

Jump to

Keyboard shortcuts

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