gcp

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend added in v0.8.0

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

func NewBackend added in v0.4.0

func NewBackend(settings Settings, logger hedwig.Logger) *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 added in v0.8.0

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

AckMessage acknowledges a message on the queue

func (*Backend) NackMessage added in v0.8.0

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

NackMessage nacks a message on the queue

func (*Backend) Publish added in v0.8.0

func (b *Backend) Publish(ctx context.Context, message *hedwig.Message, payload []byte, attributes map[string]string, topic string) (string, error)

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

func (*Backend) Receive added in v0.8.0

func (b *Backend) Receive(ctx context.Context, numMessages uint32, visibilityTimeout time.Duration, messageCh chan<- hedwig.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 added in v0.8.0

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

RequeueDLQ re-queues everything in the Hedwig DLQ back into the Hedwig queue

type Metadata added in v0.4.0

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

	// The name of the subscription the message was received from
	SubscriptionName string
	// contains filtered or unexported fields
}

Metadata is additional metadata associated with a message

type Settings added in v0.8.0

type Settings struct {
	// Hedwig queue name. Exclude the `HEDWIG-` 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

	// Subscriptions is a list of all the Hedwig topics that the app is subscribed to (exclude the “hedwig-“ prefix).
	// For subscribing to cross-project topic messages, use SubscriptionsCrossProject. Google only.
	Subscriptions []string

	// SubscriptionsCrossProject is a list of tuples of topic name and GCP project for cross-project topic messages.
	// Google only.
	SubscriptionsCrossProject []SubscriptionProject
}

Settings for Hedwig

type SubscriptionProject added in v0.8.0

type SubscriptionProject struct {
	// Subscription name
	Subscription string

	// ProjectID
	ProjectID string
}

SubscriptionProject represents a tuple of subscription name and project for cross-project Google subscriptions

Jump to

Keyboard shortcuts

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