Documentation
¶
Overview ¶
Package cloudpubsub provides a transport for Google Cloud Publisher/Subscriber.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DecodeMessageFunc ¶
DecodeMessageFunc decodes a message coming from a subscription
type EncodeMessageFunc ¶
EncodeMessageFunc encodes a message being published
type Publisher ¶
type Publisher struct {
// contains filtered or unexported fields
}
Publisher publishes messages to Google cloud pubsub
func NewPublisher ¶
func NewPublisher(client *pubsub.Client, enc EncodeMessageFunc, topic string) *Publisher
NewPublisher creates a publisher that will publish to the given topic
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
Subscriber receives messages from Google cloud pubsub
func NewSubscriber ¶
func NewSubscriber(client *pubsub.Client, e endpoint.Endpoint, dec DecodeMessageFunc, topicName string, options ...SubscriberOption) (*Subscriber, error)
NewSubscriber create a subscription of the endpoint to the given event
func (*Subscriber) Unsubscribe ¶
func (s *Subscriber) Unsubscribe()
Unsubscribe gracefully stops the subscriber from receiving messages
type SubscriberOption ¶
type SubscriberOption func(*Subscriber)
SubscriberOption sets an optional parameter for clients
func WithErrorEndpoint ¶
func WithErrorEndpoint(endpoint endpoint.Endpoint) SubscriberOption
WithErrorEndpoint specifies an endpoint to use for sending errors returned by the subscriber endpoint
func WithLogger ¶
func WithLogger(logger log.Logger) SubscriberOption
WithLogger specifies the logger to use