pubsub

package module
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PubSub

type PubSub struct {
	Client    *pubsub.Client
	Config    config.PubSubConfig
	Receivers []port.PubSubReceiver
}

PubSub represents shared Google PubSub connection

func NewPubSub

func NewPubSub(ctx context.Context, config config.PubSubConfig) (*PubSub, error)

NewPubSub creates a new PubSub connection

func (*PubSub) Connect

func (ps *PubSub) Connect() error

func (*PubSub) Disconnect

func (ps *PubSub) Disconnect() error

Close closes the PubSub connection

func (*PubSub) EnsureSubscriptionExists

func (ps *PubSub) EnsureSubscriptionExists(ctx context.Context) bool

EnsureSubscriptionExists checks if the subscription exists

func (*PubSub) EnsureTopicExists

func (ps *PubSub) EnsureTopicExists(ctx context.Context) bool

EnsureTopicExists checks if the topic exists

func (*PubSub) GetSubscriptionInfo

func (ps *PubSub) GetSubscriptionInfo(ctx context.Context) *pubsubpb.Subscription

GetSubscriptionInfo returns information about the subscription

func (*PubSub) GetTopicInfo

func (ps *PubSub) GetTopicInfo(ctx context.Context) *pubsubpb.Topic

GetTopicInfo returns information about the topic

func (*PubSub) Install

func (ps *PubSub) Install(args ...any) error

func (*PubSub) ListSubscriptions

func (ps *PubSub) ListSubscriptions(ctx context.Context) []*pubsubpb.Subscription

ListSubscriptions lists all subscriptions for this topic

func (*PubSub) Publish

func (ps *PubSub) Publish(ctx context.Context, message any, attributes map[string]string) (string, error)

func (*PubSub) PublishMessage

func (ps *PubSub) PublishMessage(ctx context.Context, data []byte, attributes map[string]string) (string, error)

PublishMessage publishes a message to the topic

func (*PubSub) PublishMessages

func (ps *PubSub) PublishMessages(ctx context.Context, messages [][]byte, attributes map[string]string) ([]string, error)

PublishMessages publishes multiple messages to the topic

func (*PubSub) PullMessages

func (ps *PubSub) PullMessages(ctx context.Context, maxMessages int) ([]*pubsub.Message, error)

PullMessages pulls messages from the subscription

func (*PubSub) RegisterReceiver

func (ps *PubSub) RegisterReceiver(receiver port.PubSubReceiver)

func (*PubSub) StartReceiving

func (ps *PubSub) StartReceiving(ctx context.Context)

func (*PubSub) Uninstall

func (ps *PubSub) Uninstall() error

type PubSubLoader

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

func (*PubSubLoader) Init

func (l *PubSubLoader) Init(args ...any) (port.Library, error)

func (*PubSubLoader) Name

func (a *PubSubLoader) Name() string

func (*PubSubLoader) SetName

func (a *PubSubLoader) SetName(name string)

type PubSubMessage

type PubSubMessage struct {
	ID          string
	Data        []byte
	PublishTime time.Time
	Attributes  map[string]string
}

PubSubMessage represents a PubSub message

func (*PubSubMessage) GetAttributes

func (p *PubSubMessage) GetAttributes() map[string]string

func (*PubSubMessage) GetData

func (p *PubSubMessage) GetData() []byte

func (*PubSubMessage) GetID

func (p *PubSubMessage) GetID() string

func (*PubSubMessage) GetPublishTime

func (p *PubSubMessage) GetPublishTime() time.Time

Jump to

Keyboard shortcuts

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