publisher

package
v0.0.0-...-c1b7731 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package publisher contains the code to talk to Google Pub/Sub.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

An Option provides additional configuration to the Publisher.

func WithHTTPCounter

func WithHTTPCounter(l *latch.Counter) Option

WithHTTPCounter uses the given counter to signal if there are any in-flight http requests.

func WithHTTPMux

func WithHTTPMux(m *http.ServeMux, pathPrefix string) Option

WithHTTPMux will register handlers in the given ServeMux to accept incoming connections and publish them.

func WithSharedKeys

func WithSharedKeys(keys []string) Option

WithSharedKeys provides a limited degree of authentication between the bridge server and the CDC client.

func WithTopicPrefix

func WithTopicPrefix(prefix string) Option

WithTopicPrefix will prepend the given prefix to the table name.

type Publisher

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

A Publisher is used to manage Topic instances.

func New

func New(client *pubsub.Client, options ...Option) *Publisher

New constructs a new Publisher around the given Client.

func (*Publisher) Publish

func (p *Publisher) Publish(ctx context.Context, table string, data []byte, attrs map[string]string) (*pubsub.PublishResult, error)

Publish will send the given message and attributes to the Pub/Sub endpoint.

Jump to

Keyboard shortcuts

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