pubsublib

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReceiveToChannel

func ReceiveToChannel(ctx context.Context, sub Receiver) <-chan MessageOrError

ReceiveToChannel pulls messages from a subscription sub until it gets an error or its context is closed. It returns the channel for messages and/or errors and is never a blocking call.

Types

type Message

type Message interface {
	Attributes() map[string]string
	Body() []byte
	ID() string
	Ack()
}

Message describes the behaviors of a pubsub message.

type MessageOrError

type MessageOrError struct {
	Message Message
	Error   error
}

MessageOrError is a wrapper type for channels which need to transmit both messages and errors.

type Receiver

type Receiver interface {
	Receive(context.Context, func(context.Context, *pubsub.Message)) error
}

Receiver is an interface wrapping pubsub.Subscription's Receive method.

Jump to

Keyboard shortcuts

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