subscriber

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 24, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleMessage added in v0.1.1

func HandleMessage(
	msg *message.Message,
	target proto.Message,
	handler func(ctx context.Context) error,
) error

Handles a message by first unmarshalling its payload to the provided 'target' and then invoking the provided handler with the context of the message. If the unmarshalling fails then we will never be able to handle this message so we ack it to "get rid of it" and return an error. But if the provided handler fails then we the message will be nack'ed (to trigger a redelivery) and no error is returned (it's up to the provided handler to log this error).

The rules are as follows: To receive the next message, `Ack()` must be called on the received message, but if the message processing failed and message should be redelivered then `Nack()` shall be called.

func InitTracedRouter

func InitTracedRouter(logger *zap.Logger) *message.Router

func UnmarshalPayload

func UnmarshalPayload(payload []byte, target proto.Message) error

Types

type Subscriber

type Subscriber struct {
	message.Subscriber
}

func NewSubscriber

func NewSubscriber(
	logger *zap.Logger,
	config *SubscriberConfig,
	registerHttpHandler googlecloud_http.RegisterHttpHandler,
) *Subscriber

type SubscriberConfig

type SubscriberConfig struct {
}

Jump to

Keyboard shortcuts

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