pubsub

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 46 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package pubsub emulates Cloud Pub/Sub (SRS 5.5): topics, subscriptions, publish, pull, streaming pull and push delivery, ordering, dead-letter topics, filters, exactly-once delivery, snapshots, seek and schemas.

The gRPC services google.pubsub.v1.{Publisher,Subscriber,SchemaService} are served on the gateway and on the dedicated Pub/Sub port (default 8085, for PUBSUB_EMULATOR_HOST); the REST v1 surface is mounted on the gateway under /pubsub/ and served on the dedicated port too.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(env *emu.Env) emu.Service

New returns the service.

Types

type Service

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

Service is the Pub/Sub service module.

func (*Service) ApplySeed

func (s *Service) ApplySeed(ctx context.Context, section *yaml.Node, baseDir string) error

ApplySeed creates (or updates) the seeded resources idempotently.

func (*Service) ClockAdvanced

func (s *Service) ClockAdvanced(ctx context.Context) error

ClockAdvanced re-applies message retention and snapshot expiry after `gcpemu time advance`.

func (*Service) EnvVars

func (s *Service) EnvVars(gw string, endpoints map[string]string) map[string]string

EnvVars implements emu.EnvVarer (FR-CORE-004).

func (*Service) Name

func (s *Service) Name() string

func (*Service) PublishInternal

func (s *Service) PublishInternal(ctx context.Context, topicName string, data []byte, attrs map[string]string) (string, error)

PublishInternal implements emu.Publisher for other services (FR-GCS-007).

func (*Service) Ready

func (s *Service) Ready() error

Ready reports whether state has been loaded.

func (*Service) Register

func (s *Service) Register(r emu.Router) error

Register loads persisted state and mounts the gRPC and REST APIs on the gateway (FR-CORE-040).

func (*Service) Reset

func (s *Service) Reset(ctx context.Context) error

Reset drops all in-memory state (FR-CORE-002); the store is wiped by the caller.

func (*Service) ResourceCounts added in v0.2.0

func (s *Service) ResourceCounts() map[string]int

ResourceCounts implements emu.ResourceCounter.

func (*Service) Start

func (s *Service) Start(ctx context.Context) error

Start opens the dedicated Pub/Sub port (FR-CORE-041), which serves gRPC (for PUBSUB_EMULATOR_HOST) and REST, and starts background delivery.

func (*Service) Stop

func (s *Service) Stop(ctx context.Context) error

Stop ends streams, background work and the dedicated listener.

func (*Service) TopicExists

func (s *Service) TopicExists(ctx context.Context, topicName string) bool

TopicExists implements emu.Publisher.

Jump to

Keyboard shortcuts

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