Documentation
¶
Index ¶
- func GCPCreateSubscription(ctx context.Context, projectID, subID string, ...) (*pubsub.Subscription, error)
- func GCPCreateTopic(ctx context.Context, projectID, topicID string) (*pubsub.Topic, error)
- func NewDevelopmentConfig() zap.Config
- func NewDevelopmentEncoderConfig() zapcore.EncoderConfig
- func NewLogger() (logger *zap.Logger, err error)
- func NewProductionConfig() zap.Config
- func NewProductionEncoderConfig() zapcore.EncoderConfig
- type Consumer
- type Handler
- type Producer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GCPCreateSubscription ¶
func GCPCreateSubscription(ctx context.Context, projectID, subID string, subConfig pubsub.SubscriptionConfig) (*pubsub.Subscription, error)
GCPCreateSubscription creates a new subscription on google cloud pubsub and deal if subscription already exists.
func GCPCreateTopic ¶
GCPCreateTopic creates a new topic on google cloud pubsub and deal if topic already exists.
func NewDevelopmentConfig ¶
NewDevelopmentConfig is a reasonable development logging configuration. Logging is enabled at DebugLevel and above.
It enables development mode (which makes DPanicLevel logs panic), uses a console encoder, writes to standard error, and disables sampling. Stacktraces are automatically included on logs of WarnLevel and above.
func NewDevelopmentEncoderConfig ¶
func NewDevelopmentEncoderConfig() zapcore.EncoderConfig
NewDevelopmentEncoderConfig returns an opinionated EncoderConfig for development environments.
func NewLogger ¶
NewLogger returns a zap logger based on LOG_CONFIG envvar if LOG_CONFIG=="production" returns zap.NewProduction() else returns zap.NewDevelopment()
func NewProductionConfig ¶
NewProductionConfig is a reasonable production logging configuration. Logging is enabled at InfoLevel and above.
It uses a JSON encoder, writes to standard error, and enables sampling. Stacktraces are automatically included on logs of ErrorLevel and above.
func NewProductionEncoderConfig ¶
func NewProductionEncoderConfig() zapcore.EncoderConfig
NewProductionEncoderConfig returns an opinionated EncoderConfig for production environments.
Types ¶
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
Consumer allows you to consume message from a specific subscription.
func OpenConsumer ¶
func OpenConsumer(ctx context.Context, driverURL string, fn Handler, maxGoroutines int) (Consumer, error)
OpenConsumer returns a new consumer.
type Handler ¶
type Handler func(ctx context.Context, msg *gocloudpubsub.Message) error
Handler represents a function to be passed to consumer.