message

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: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BuildIDKey is the key to store Build ID in message attributes.
	BuildIDKey = "build_id"
	// ParentUIDKey is the key to store parent UID.
	ParentUIDKey = "parent_uid"
	// ShouldPollForCompletionKey is the key to store flag should_poll_for_completion.
	ShouldPollForCompletionKey = "should_poll_for_completion"
)

Variables

This section is empty.

Functions

func ExtractBuildIDMap

func ExtractBuildIDMap(ctx context.Context, msgs []*pubsubpb.ReceivedMessage) map[int64]*pubsubpb.ReceivedMessage

ExtractBuildIDMap generates a map with key of Build ID and the value of parent UID.

func GetParentUID

func GetParentUID(msg *pubsubpb.ReceivedMessage) string

GetParentUID reads the parent request UID from the message's attributes.

func PublishBuild

func PublishBuild(ctx context.Context, attr map[string]string, conf *result_flow.PubSubConfig, opts ...option.ClientOption) error

PublishBuild publishes a Build to PubSub.

func ShouldPollForCompletion

func ShouldPollForCompletion(msg *pubsubpb.ReceivedMessage) bool

ShouldPollForCompletion returns true if the message contains the attribute "should_poll_for_completion" and its value is boolean true represented by a string.

Types

type Client

type Client interface {
	PullMessages(context.Context) ([]*pubsubpb.ReceivedMessage, error)
	AckMessages(context.Context, []*pubsubpb.ReceivedMessage) error
	Close() error
}

Client defines an interface used to interact with pubsub

func NewClient

func NewClient(c context.Context, conf *result_flow.PubSubConfig, batchSize int32, opts ...option.ClientOption) (Client, error)

NewClient creates a messageClient for PubSub subscriber.

Jump to

Keyboard shortcuts

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