publish

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package publish contains utilities related to publishing messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metadata

type Metadata struct {
	// The topic partition the message was published to.
	Partition int

	// The offset the message was assigned.
	Offset int64
}

Metadata holds the result of publishing a message to the Pub/Sub Lite service.

func ParseMetadata

func ParseMetadata(id string) (*Metadata, error)

ParseMetadata converts the ID string of a pubsub.PublishResult to Metadata.

Example:

result := publisher.Publish(ctx, &pubsub.Message{Data: []byte("payload")})
id, err := result.Get(ctx)
if err != nil {
  // TODO: Handle error.
}
metadata, err := publish.ParseMetadata(id)
if err != nil {
  // TODO: Handle error.
}

func (*Metadata) String

func (m *Metadata) String() string

Jump to

Keyboard shortcuts

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