internal

package
v2.0.0-RC4 Latest Latest
Warning

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

Go to latest
Published: May 13, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package internal provides the internal pubsub Connection type.

Index

Constants

View Source
const (
	DefaultAckDeadline       = 30 * time.Second
	DefaultRetentionDuration = 25 * time.Hour
)

Variables

View Source
var DefaultReceiveSettings = pubsub.ReceiveSettings{

	NumGoroutines: 1000,
	Synchronous:   false,
}

Functions

This section is empty.

Types

type Connection

type Connection struct {
	// AllowCreateTopic controls if the protocol can create a topic if it does
	// not exist.
	AllowCreateTopic bool

	// AllowCreateSubscription controls if the protocol can create a
	// subscription if it does not exist.
	AllowCreateSubscription bool

	ProjectID string

	Client *pubsub.Client

	TopicID string

	SubscriptionID string

	// ReceiveSettings is used to configure Pubsub pull subscription.
	ReceiveSettings *pubsub.ReceiveSettings

	// AckDeadline is Pub/Sub AckDeadline.
	// Default is 30 seconds.
	// This can only be set prior to first call of any function.
	AckDeadline *time.Duration
	// RetentionDuration is Pub/Sub RetentionDuration.
	// Default is 25 hours.
	// This can only be set prior to first call of any function.
	RetentionDuration *time.Duration
	// contains filtered or unexported fields
}

Connection acts as either a pubsub topic or a pubsub subscription .

func (*Connection) DeleteSubscription

func (c *Connection) DeleteSubscription(ctx context.Context) error

DeleteSubscription delete's the connection's subscription

func (*Connection) DeleteTopic

func (c *Connection) DeleteTopic(ctx context.Context) error

DeleteTopic deletes the connection's topic

func (*Connection) Publish

func (c *Connection) Publish(ctx context.Context, msg *pubsub.Message) (*binding.Message, error)

Publish publishes a message to the connection's topic

func (*Connection) Receive

func (c *Connection) Receive(ctx context.Context, fn func(context.Context, *pubsub.Message)) error

Receive begins pulling messages. NOTE: This is a blocking call.

Jump to

Keyboard shortcuts

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