pubsub2

package
v0.0.0-...-9357fd6 Latest Latest
Warning

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

Go to latest
Published: May 24, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Body

type Body struct {
	Message      *Message `json:"message"`
	Subscription string   `json:"subscription"`

	// DeliveryAttempt is the number of times a message has been delivered.
	// This is part of the dead lettering feature that forwards messages that
	// fail to be processed (from nack/ack deadline timeout) to a dead letter topic.
	// If dead lettering is enabled, this will be set on all attempts, starting
	// with value 1. Otherwise, the value will be nil.
	// This field is read-only.
	DeliveryAttempt int `json:"deliveryAttempt"`
}

type HelloHandler

type HelloHandler struct {
	// contains filtered or unexported fields
}

func NewHelloHandler

func NewHelloHandler(ctx context.Context, helloTopicPubSubService *PubSubService, helloOrderPubSubService *PubSubService) (*HelloHandler, error)

func (*HelloHandler) Handle

func (h *HelloHandler) Handle(w http.ResponseWriter, r *http.Request)

type Message

type Message struct {
	// ID identifies this message. This ID is assigned by the server and is
	// populated for Messages obtained from a subscription.
	//
	// This field is read-only.
	MessageID string `json:"messageId"`

	// Data is the actual data in the message.
	Data []byte `json:"data"`

	// Attributes represents the key-value pairs the current message is
	// labelled with.
	Attributes map[string]string `json:"attributes"`

	// PublishTime is the time at which the message was published. This is
	// populated by the server for Messages obtained from a subscription.
	//
	// This field is read-only.
	PublishTime time.Time `json:"publishTime"`

	// OrderingKey identifies related messages for which publish order should
	// be respected. If empty string is used, message will be sent unordered.
	OrderingKey string `json:"orderingKey"`
}

type PubSubService

type PubSubService struct {
	// contains filtered or unexported fields
}

func NewPubSubService

func NewPubSubService(ctx context.Context, ps *pubsub.Client, topicID string, projectID string, enableMessageOrdering bool) (*PubSubService, error)

func (*PubSubService) Flush

func (s *PubSubService) Flush(ctx context.Context)

func (*PubSubService) Publish

func (*PubSubService) PublishWithGet

func (s *PubSubService) PublishWithGet(ctx context.Context, msg *pubsub.Message) (serverID string, err error)

type ReceiveHandler

type ReceiveHandler struct {
}

func NewReceiveHandler

func NewReceiveHandler(ctx context.Context) (*ReceiveHandler, error)

func (*ReceiveHandler) Handle

func (h *ReceiveHandler) Handle(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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