google

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProviderLogger = logger.HcLog().Named("raiden.pubsub.google")

Functions

func ExtractTraceSubscriber

func ExtractTraceSubscriber(ctx context.Context, tracer trace.Tracer, traceId string, spanId string, subscriberName string) (rCtx context.Context, span trace.Span)

ExtractTraceSubscriber reconstructs a span context from message attributes.

Types

type GooglePubSubClient

type GooglePubSubClient struct {
	Client *pubsub.Client
}

func (*GooglePubSubClient) Close

func (g *GooglePubSubClient) Close() error

func (*GooglePubSubClient) CreateSubscription

func (g *GooglePubSubClient) CreateSubscription(ctx context.Context, id string, cfg pubsub.SubscriptionConfig) (Subscription, error)

func (*GooglePubSubClient) Subscription

func (g *GooglePubSubClient) Subscription(id string) Subscription

func (*GooglePubSubClient) Topic

func (g *GooglePubSubClient) Topic(id string) Topic

type GooglePublishResult

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

func (*GooglePublishResult) Get

type GoogleSubscription

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

func (*GoogleSubscription) ID

func (g *GoogleSubscription) ID() string

func (*GoogleSubscription) Receive

func (g *GoogleSubscription) Receive(ctx context.Context, f func(ctx context.Context, msg *pubsub.Message)) error

type GoogleTopic

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

func (*GoogleTopic) GetInstance

func (g *GoogleTopic) GetInstance() *pubsub.Topic

func (*GoogleTopic) Publish

func (g *GoogleTopic) Publish(ctx context.Context, msg *pubsub.Message) PublishResult

type ListenHandler

type ListenHandler struct {
	Name         string
	Subscription string
	AutoAck      bool
	ConsumeFn    func(ctx context.Context, span trace.Span, msg any) error
}

ListenHandler describes a pull-subscription handler for StartListen.

type Provider

type Provider struct {
	Config *ProviderConfig
	Client PubSubClient
	Tracer trace.Tracer
}

Provider implements Google Cloud Pub/Sub operations.

func (*Provider) CreateClient

func (s *Provider) CreateClient() error

func (*Provider) CreateSubscription

func (s *Provider) CreateSubscription(name, topic, pushEndpoint, serverDns, subscription, prefixEndpoint string) error

func (*Provider) Publish

func (s *Provider) Publish(ctx context.Context, topic string, message []byte) error

func (*Provider) StartListen

func (s *Provider) StartListen(handlers []ListenHandler) error

func (*Provider) StopListen

func (s *Provider) StopListen() error

func (*Provider) Validate

func (s *Provider) Validate() error

type ProviderConfig

type ProviderConfig struct {
	GoogleProjectId string
	GoogleSaPath    string
}

ProviderConfig holds Google-specific configuration.

type PubSubClient

type PubSubClient interface {
	CreateSubscription(ctx context.Context, id string, cfg pubsub.SubscriptionConfig) (Subscription, error)
	Subscription(id string) Subscription
	Topic(id string) Topic
	Close() error
}

PubSubClient defines the methods required for Pub/Sub client interaction.

type PublishResult

type PublishResult interface {
	Get(ctx context.Context) (string, error)
}

PublishResult abstracts the result of publishing a message.

type Subscription

type Subscription interface {
	ID() string
	Receive(ctx context.Context, f func(ctx context.Context, msg *pubsub.Message)) error
}

Subscription defines the methods required for subscriptions.

type Topic

type Topic interface {
	Publish(ctx context.Context, msg *pubsub.Message) PublishResult
	GetInstance() *pubsub.Topic
}

Topic defines the methods required for publishing messages.

Jump to

Keyboard shortcuts

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