pubsub

package
v0.0.87 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_MESSAGES = 10 // Maximum number of messages to book at a time
	SYNCHRONOUS  = false
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	PubSubClient *pubsub.Client
	Ctx          context.Context
	Synchronous  bool
	MaxMessages  int
	// contains filtered or unexported fields
}

func NewAsyncClient

func NewAsyncClient() (*Client, error)

func NewClient

func NewClient(ctx context.Context) (c *Client, err error)

func (*Client) Publish

func (psClient *Client) Publish(topic string, message Message) error

func (*Client) Pull

func (psClient *Client) Pull(subscription string, handler func(message Message) bool) error

func (*Client) SetContext

func (psClient *Client) SetContext(ctx context.Context)

type Message

type Message interface {
	GetId() string
	GetData() ([]byte, error)
	GetAttributes() (map[string]string, error)
}

func NewPubSubMessage

func NewPubSubMessage(msg *pubsub.Message) Message

type PubSubMessage

type PubSubMessage struct {
	Message *pubsub.Message
}

func (PubSubMessage) GetAttributes

func (message PubSubMessage) GetAttributes() (map[string]string, error)

func (PubSubMessage) GetData

func (message PubSubMessage) GetData() ([]byte, error)

func (PubSubMessage) GetId

func (message PubSubMessage) GetId() string

Jump to

Keyboard shortcuts

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