Documentation
¶
Index ¶
- type PubSub
- func (ps *PubSub) Connect() error
- func (ps *PubSub) Disconnect() error
- func (ps *PubSub) EnsureSubscriptionExists(ctx context.Context) bool
- func (ps *PubSub) EnsureTopicExists(ctx context.Context) bool
- func (ps *PubSub) GetSubscriptionInfo(ctx context.Context) *pubsubpb.Subscription
- func (ps *PubSub) GetTopicInfo(ctx context.Context) *pubsubpb.Topic
- func (ps *PubSub) Install(args ...any) error
- func (ps *PubSub) ListSubscriptions(ctx context.Context) []*pubsubpb.Subscription
- func (ps *PubSub) Publish(ctx context.Context, message any, attributes map[string]string) (string, error)
- func (ps *PubSub) PublishMessage(ctx context.Context, data []byte, attributes map[string]string) (string, error)
- func (ps *PubSub) PublishMessages(ctx context.Context, messages [][]byte, attributes map[string]string) ([]string, error)
- func (ps *PubSub) PullMessages(ctx context.Context, maxMessages int) ([]*pubsub.Message, error)
- func (ps *PubSub) RegisterReceiver(receiver port.PubSubReceiver)
- func (ps *PubSub) StartReceiving(ctx context.Context)
- func (ps *PubSub) Uninstall() error
- type PubSubLoader
- type PubSubMessage
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 (*PubSub) EnsureSubscriptionExists ¶
EnsureSubscriptionExists checks if the subscription exists
func (*PubSub) EnsureTopicExists ¶
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 ¶
GetTopicInfo returns information about the topic
func (*PubSub) ListSubscriptions ¶
func (ps *PubSub) ListSubscriptions(ctx context.Context) []*pubsubpb.Subscription
ListSubscriptions lists all subscriptions for this topic
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 ¶
PullMessages pulls messages from the subscription
func (*PubSub) RegisterReceiver ¶
func (ps *PubSub) RegisterReceiver(receiver port.PubSubReceiver)
func (*PubSub) StartReceiving ¶
type PubSubLoader ¶
type PubSubLoader struct {
// contains filtered or unexported fields
}
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
Click to show internal directories.
Click to hide internal directories.