gcppubsubevents

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package gcppubsubevents provides a Google Pub/Sub-backed events transport driver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ProjectID string
	URI       string
	Client    *gpubsub.Client
}

Config configures Google Pub/Sub transport construction. @group Config

Example: define Google Pub/Sub driver config

cfg := gcppubsubevents.Config{
	ProjectID: "events-project",
	URI:       "127.0.0.1:8085",
}
_ = cfg

Example: define Google Pub/Sub driver config with all fields

cfg := gcppubsubevents.Config{
	ProjectID: "events-project",
	URI:       "127.0.0.1:8085", // default: "" is invalid unless Client is provided
	Client:    nil,              // default: nil creates a client from ProjectID and URI
}
_ = cfg

type Driver

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

Driver is a Google Pub/Sub-backed events transport. @group Drivers

Example: keep a Google Pub/Sub driver reference

var driver *gcppubsubevents.Driver
fmt.Println(driver == nil)
// Output: true

func New

func New(ctx context.Context, cfg Config) (*Driver, error)

New constructs a Google Pub/Sub-backed driver. @group Driver Constructors

Example: construct a Google Pub/Sub driver

driver, _ := gcppubsubevents.New(context.Background(), gcppubsubevents.Config{
	ProjectID: "events-project",
	URI:       "127.0.0.1:8085",
})
_ = driver

func (*Driver) Close

func (d *Driver) Close() error

Close closes the underlying Pub/Sub client. @group Lifecycle

func (*Driver) Driver

func (d *Driver) Driver() eventscore.Driver

Driver reports the active backend kind. @group Drivers

func (*Driver) PublishContext

func (d *Driver) PublishContext(ctx context.Context, msg eventscore.Message) error

PublishContext publishes a topic payload to Google Pub/Sub. @group Drivers

func (*Driver) Ready

func (d *Driver) Ready(ctx context.Context) error

Ready checks Google Pub/Sub connectivity. @group Drivers

func (*Driver) SubscribeContext

func (d *Driver) SubscribeContext(ctx context.Context, topic string, handler eventscore.MessageHandler) (eventscore.Subscription, error)

SubscribeContext subscribes to a Google Pub/Sub topic and forwards messages. @group Drivers

Jump to

Keyboard shortcuts

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