v0.0.0-...-c52b3dd Latest Latest

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

Go to latest
Published: Mar 3, 2020 License: Apache-2.0 Imports: 23 Imported by: 0



Package converters contains pubsub message to cloudevent converters used by pubsub-based source.



View Source
const (
	CloudAuditLogsConverter = ""
View Source
const (
	CloudSchedulerConverter = ""
View Source
const (
	CloudStorageConverter = ""


This section is empty.


func Convert

func Convert(ctx context.Context, msg *cepubsub.Message, sendMode ModeType, converterType string) (*cloudevents.Event, error)

Convert converts a message off the pubsub format to a source specific if there's a registered handler for the type in the converters map. If there's no registered handler, a default Pubsub one will be used.


type ModeType

type ModeType string

ModeType is the type for mode enum.

const (
	// Binary mode is binary encoding.
	Binary ModeType = "binary"
	// Structured mode is structured encoding.
	Structured ModeType = "structured"
	// Push mode emulates Pub/Sub push encoding.
	Push ModeType = "push"
	// DefaultSendMode is the default choice.
	DefaultSendMode = Binary
	// The key used in the message attributes which defines the converter type.
	KnativeGCPConverter = "knative-gcp"

type PubSubMessage

type PubSubMessage 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.
	ID string `json:"messageId,omitempty"`

	// Data is the actual data in the message.
	Data interface{} `json:"data,omitempty"`

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

	// 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,omitempty"`

PubSubMessage matches the inner message format used by Push Subscriptions.

type PushMessage

type PushMessage struct {
	// Subscription is the subscription ID that received this Message.
	Subscription string `json:"subscription"`
	// Message holds the Pub/Sub message contents.
	Message *PubSubMessage `json:"message,omitempty"`

PushMessage represents the format Pub/Sub uses to push events.

type UnknownMsg

type UnknownMsg empty.Empty

func (*UnknownMsg) ProtoMessage

func (m *UnknownMsg) ProtoMessage()

func (*UnknownMsg) Reset

func (m *UnknownMsg) Reset()

func (*UnknownMsg) String

func (m *UnknownMsg) String() string

Jump to

Keyboard shortcuts

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