Documentation ¶
Overview ¶
Package google provides methods to work with Google Cloud Pub/Sub enabling the publishing and consumption of messages.
Index ¶
- type Config
- type GCPubSub
- func (g *GCPubSub) Bind(message []byte, target interface{}) error
- func (g *GCPubSub) CommitOffset(pubsub.TopicPartition)
- func (g *GCPubSub) HealthCheck() types.Health
- func (g *GCPubSub) IsSet() bool
- func (g *GCPubSub) Ping() error
- func (g *GCPubSub) PublishEvent(key string, value interface{}, headers map[string]string) error
- func (g *GCPubSub) PublishEventWithOptions(_ string, value interface{}, headers map[string]string, ...) (err error)
- func (g *GCPubSub) Subscribe() (*pubsub.Message, error)
- func (g *GCPubSub) SubscribeWithCommit(commitFunc pubsub.CommitFunc) (*pubsub.Message, error)
- type Subscription
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { TopicName string ProjectID string SubscriptionDetails *Subscription Topic *gpubsub.Topic TimeoutDuration int ConnRetryDuration int Subscription *gpubsub.Subscription }
Config stores the configuration parameters required to connect to Google Cloud Pub/Sub.
type GCPubSub ¶
type GCPubSub struct {
// contains filtered or unexported fields
}
GCPubSub is a client for interacting with Google Cloud Pub/Sub.
func (*GCPubSub) CommitOffset ¶
func (g *GCPubSub) CommitOffset(pubsub.TopicPartition)
CommitOffset In Google Cloud Pub/Sub, there is no direct equivalent to committing offsets as in Apache Kafka. Pub/Sub is a fully-managed service where the acknowledgment of messages is handled automatically. In Pub/Sub, once a message is received and processed by a subscriber, it is automatically acknowledged by the service. There is no need to explicitly commit offsets or track offsets manually like in Kafka.
func (*GCPubSub) HealthCheck ¶
HealthCheck returns the health of the Pub/Sub
func (*GCPubSub) Ping ¶
Ping checks for the health of google Pub/Sub, returns an error if it is down
func (*GCPubSub) PublishEvent ¶
PublishEvent publishes the event to google Pub/Sub
func (*GCPubSub) PublishEventWithOptions ¶
func (g *GCPubSub) PublishEventWithOptions(_ string, value interface{}, headers map[string]string, options *pubsub.PublishOptions) (err error)
PublishEventWithOptions publishes message to google Pub/Sub. Ability to provide additional options described in PublishOptions struct
func (*GCPubSub) SubscribeWithCommit ¶
SubscribeWithCommit calls the CommitFunc after subscribing message from googlePubSub and based on the return values decides whether to commit message and consume another message
type Subscription ¶
type Subscription struct {
Name string
}
Subscription defines the name of the Pub/Sub subscription.