pubsub

package
v1.0.68 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildDescErrorMsg added in v1.0.6

func BuildDescErrorMsg(desc string, err error) string

func NewGooglePubSub

func NewGooglePubSub(config *common_utils.BaseConfig) (c *pubsub.Client, err error)

func SetRetryOrSetDataToDB added in v1.0.6

func SetRetryOrSetDataToDB(config *common_utils.BaseConfig, msg *pubsub.Message, cb func())

Types

type GooglePubSub

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

type PubSubClient

type PubSubClient interface {
	CreateTopicIfNotExists(ctx context.Context, topicName string) (*pubsub.Topic, error)
	CreateSubscriptionIfNotExists(ctx context.Context, id string, topic *pubsub.Topic) (*pubsub.Subscription, error)
	PublishTopics(ctx context.Context, topics []*pubsub.Topic, data any, orderingKey string) error
	PullMessages(ctx context.Context, id string, topic *pubsub.Topic, callback func(ctx context.Context, msg *pubsub.Message)) error
	Close() error
	CheckTopicAndPublish(ctx context.Context, topicsName []string, orderingKey string, data any)
}

func NewPubSubClient

func NewPubSubClient(config *common_utils.BaseConfig, pubSub GooglePubSub) PubSubClient

type PubSubClientImpl

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

func (*PubSubClientImpl) CheckTopicAndPublish

func (p *PubSubClientImpl) CheckTopicAndPublish(
	ctx context.Context,
	topicsName []string,
	orderingKey string,
	data any,
)

func (*PubSubClientImpl) Close

func (p *PubSubClientImpl) Close() error

func (*PubSubClientImpl) CreateSubscriptionIfNotExists

func (p *PubSubClientImpl) CreateSubscriptionIfNotExists(ctx context.Context, id string, topic *pubsub.Topic) (*pubsub.Subscription, error)

func (*PubSubClientImpl) CreateTopicIfNotExists

func (p *PubSubClientImpl) CreateTopicIfNotExists(ctx context.Context, topicName string) (*pubsub.Topic, error)

func (*PubSubClientImpl) PublishTopics

func (p *PubSubClientImpl) PublishTopics(ctx context.Context, topics []*pubsub.Topic, data any, orderingKey string) error

func (*PubSubClientImpl) PullMessages

func (p *PubSubClientImpl) PullMessages(ctx context.Context, id string, topic *pubsub.Topic, callback func(ctx context.Context, msg *pubsub.Message)) error

Directories

Path Synopsis
Code generated by MockGen.
Code generated by MockGen.

Jump to

Keyboard shortcuts

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