gcp

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	QueueName string
	// contains filtered or unexported fields
}

func NewBackend

func NewBackend(settings Settings, getLogger taskhawk.GetLoggerFunc) *Backend

NewBackend creates a Backend for publishing and consuming from GCP The provider metadata produced by this Backend will have concrete type: gcp.Metadata

func (*Backend) AckMessage

func (b *Backend) AckMessage(ctx context.Context, providerMetadata interface{}) error

AckMessage acknowledges a message on the queue

func (*Backend) NackMessage

func (b *Backend) NackMessage(ctx context.Context, providerMetadata interface{}) error

NackMessage nacks a message on the queue

func (*Backend) Publish

func (b *Backend) Publish(ctx context.Context, payload []byte, attributes map[string]string, priority taskhawk.Priority) (string, error)

Publish a message represented by the payload, with specified attributes to the specific topic

func (*Backend) Receive

func (b *Backend) Receive(ctx context.Context, priority taskhawk.Priority, numMessages uint32,
	visibilityTimeout time.Duration, messageCh chan<- taskhawk.ReceivedMessage) error

Receive messages from configured queue(s) and provide it through the callback. This should run indefinitely until the context is canceled. Provider metadata should include all info necessary to ack/nack a message.

func (*Backend) RequeueDLQ

func (b *Backend) RequeueDLQ(ctx context.Context, priority taskhawk.Priority, numMessages uint32,
	visibilityTimeout time.Duration) error

RequeueDLQ re-queues everything in the taskhawk.DLQ back into the taskhawk.queue

type Metadata

type Metadata struct {

	// PublishTime is the time this message was originally published to Pub/Sub
	PublishTime time.Time

	// DeliveryAttempt is the counter received from Pub/Sub.
	//    The first delivery of a given message will have this value as 1. The value
	//    is calculated as best effort and is approximate.
	DeliveryAttempt int
	// contains filtered or unexported fields
}

Metadata is additional metadata associated with a message

type Settings

type Settings struct {
	// taskhawk.queue name. Exclude the `taskhawk.` prefix
	QueueName string

	// GoogleCloudProject ID that contains Pub/Sub resources.
	GoogleCloudProject string

	// PubsubClientOptions is a list of options to pass to pubsub.NewClient. This may be useful to customize GRPC
	// behavior for example.
	PubsubClientOptions []option.ClientOption
}

Settings for Hedwig

Jump to

Keyboard shortcuts

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