publisher

package module
v0.0.0-...-183fa20 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2024 License: MIT Imports: 11 Imported by: 0

README

publisher

Manipulate and evaluate the health of your subscription and reduce your dead-end tasks.

Command Line Interface

Metrics

Evaluate the health of your subscription

    go run github.com/perebaj/publisher/cmd metrics@latest --help

Documentation

Overview

Package publisher pubsub.go is the implementation of the function that deal with pubsub messages.

Package publisher provides a simple scheduler implementation to trigger some routine at a given interval.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ListDLQSubscriptions

func ListDLQSubscriptions(ctx context.Context, projectID string) ([]string, error)

ListDLQSubscriptions returns a list of all the dead-letter-queue subscriptions present in the projectID provided

func NumUndeliveredMessagesMean

func NumUndeliveredMessagesMean(ctx context.Context, projectID, subscriptionID string) (*float64, error)

NumUndeliveredMessagesMean returns the number of undelivered messages in the subscription

Types

type Handler

type Handler func(msg *pubsub.Message) error

Handler is a generic function to handle messages.

type Scheduler

type Scheduler struct {
	// Ticker is a time.Ticker object
	Ticker *time.Ticker
	// Done is a channel to stop the scheduler
	Done chan struct{}
}

Scheduler gather all the necessary fields to run a scheduler

func NewScheduler

func NewScheduler(duration time.Duration) *Scheduler

NewScheduler creates a new scheduler

func (*Scheduler) Run

func (s *Scheduler) Run(f func())

Run starts the scheduler

type Subscription

type Subscription struct {
	Done chan struct{}
	// contains filtered or unexported fields
}

Subscription represents a subscription to a pubsub topic.

func NewSubscription

func NewSubscription(subscription *pubsub.Subscription, messages2Pull int) *Subscription

NewSubscription creates a new Subscription.

func (*Subscription) Receive

func (s *Subscription) Receive(ctx context.Context, handler Handler) error

Receive starts receiving messages from the subscription.

Directories

Path Synopsis
cmd
metrics
Package main from cmd/metrics/root.go is the CLI implementation to get metrics from GCP.
Package main from cmd/metrics/root.go is the CLI implementation to get metrics from GCP.
pool
Package main cmd/pool/main.go is the entry point of the pool application.
Package main cmd/pool/main.go is the entry point of the pool application.
publisher
Package main is the entry point of the publisher application.
Package main is the entry point of the publisher application.

Jump to

Keyboard shortcuts

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