Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultSubscriberClient ¶
func DefaultSubscriberClient(ctx context.Context) (*gcppubsub.SubscriberClient, error)
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewConsumer ¶
func NewConsumer(projectID, subscriptionID string, opts ...ConsumerOption) (*Client, error)
NewConsumer returns a pubsub task queue client.
func (*Client) SetProcessOption ¶
func (c *Client) SetProcessOption(opts ...ProcessOption)
type ConsumerOption ¶
type ConsumerOption func(o *consumerOptions)
func WithMonitoringClient ¶
func WithMonitoringClient(m *monitoring.MetricClient) ConsumerOption
func WithSubscriberClient ¶
func WithSubscriberClient(ps *gcppubsub.SubscriberClient) ConsumerOption
type ProcessOption ¶
type ProcessOption func(o *processOptions)
func ExitOnExtensionError ¶
func ExitOnExtensionError() ProcessOption
ExitOnExtensionError will make Process return an error immediately if the pubsub extension/ acknowledgement process failed, without waiting for the callback to return its success/failure (i.e. the callback is still runnning in a goroutine until it checks that it's context has been cancelled. This option can/should be used when Process() will be calling long-running cgo calls where we cannot ensure that context cancellation can be checked or acted upon (it is not possible to interrupt a cgo call). When using this option, and to avoid ressource leaks, it is highly recommended that the caller of Process() ensures that the whole program exits as soon as possible after it receives a non nil error return value.
func ExtensionPeriod ¶
func ExtensionPeriod(t time.Duration) ProcessOption
ExtensionPeriod is the duration by which to extend the ack deadline at a time. The ack deadline will continue to be extended by up to this duration until MaxExtension is reached. Setting ExtensionPeriod bounds the maximum amount of time before a message redelivery in the event the subscriber fails to extend the deadline.
ExtensionPeriod configuration can be disabled by specifying a duration less than (or equal to) 0.
func OnErrorRetryDelay ¶
func OnErrorRetryDelay(t time.Duration) ProcessOption
func ReturnImmediately ¶
func ReturnImmediately() ProcessOption
ReturnImmediately will return nil immediately if there are no messages to process. If not set, Process will block until a message becomes available
type Publisher ¶
type Publisher struct {
// contains filtered or unexported fields
}
Publisher implements messaging.Publisher
func NewPublisher ¶
func NewPublisher(ctx context.Context, projectID, topic string, opts ...PublisherOption) (*Publisher, error)
NewPublisher creates a pubsub publisher
type PublisherOption ¶
type PublisherOption func(o *publisherOptions)
func WithMaxRetries ¶
func WithMaxRetries(maxRetries int) PublisherOption