pubsub

package
v1.12.2-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Metadata = "metadata"
	Entries  = "entries"
)
View Source
const (
	APIVersionV1alpha1 = "dapr.io/v1alpha1"
	APIVersionV2alpha1 = "dapr.io/v2alpha1"
)

Variables

View Source
var ErrBulkPublishFailure = errors.New("bulk publish failed")

Functions

func ApplyBulkPublishResiliency added in v1.10.0

func NewBulkSubscribeEnvelope added in v1.10.0

func NewBulkSubscribeEnvelope(req *BulkSubscribeEnvelope) map[string]interface{}

func NewCloudEvent added in v1.0.0

func NewCloudEvent(req *CloudEvent, metadata map[string]string) (map[string]interface{}, error)

NewCloudEvent encapsulates the creation of a Dapr cloudevent from an existing cloudevent or a raw payload.

func NewDefaultBulkPublisher added in v1.10.0

func NewDefaultBulkPublisher(p contribPubsub.PubSub) contribPubsub.BulkPublisher

NewDefaultBulkPublisher returns a new defaultBulkPublisher from a PubSub.

func NewDefaultBulkSubscriber added in v1.10.0

func NewDefaultBulkSubscriber(p contribPubsub.PubSub) *defaultBulkSubscriber

NewDefaultBulkSubscriber returns a new defaultBulkSubscriber from a PubSub.

func NewOutbox added in v1.12.0

func NewOutbox(publishFn func(context.Context, *contribPubsub.PublishRequest) error, getPubsubFn func(string) (contribPubsub.PubSub, bool), getStateFn func(string) (state.Store, bool), cloudEventExtractorFn func(map[string]any, string) string, namespace string) outbox.Outbox

NewOutbox returns an instance of an Outbox.

Types

type Adapter added in v1.0.0

Adapter is the interface for message buses.

type BulkSubscribe added in v1.10.0

type BulkSubscribe struct {
	Enabled            bool  `json:"enabled"`
	MaxMessagesCount   int32 `json:"maxMessagesCount,omitempty"`
	MaxAwaitDurationMs int32 `json:"maxAwaitDurationMs,omitempty"`
}

type BulkSubscribeEnvelope added in v1.10.0

type BulkSubscribeEnvelope struct {
	ID        string
	Entries   []BulkSubscribeMessageItem
	Metadata  map[string]string
	Topic     string
	Pubsub    string
	EventType string
}

type BulkSubscribeJSON added in v1.10.0

type BulkSubscribeJSON struct {
	Enabled            bool  `json:"enabled"`
	MaxMessagesCount   int32 `json:"maxMessagesCount,omitempty"`
	MaxAwaitDurationMs int32 `json:"maxAwaitDurationMs,omitempty"`
}

type BulkSubscribeMessageItem added in v1.10.0

type BulkSubscribeMessageItem struct {
	EntryId     string            `json:"entryId"` //nolint:stylecheck
	Event       interface{}       `json:"event"`
	Metadata    map[string]string `json:"metadata"`
	ContentType string            `json:"contentType,omitempty"`
}

type CloudEvent added in v1.0.0

type CloudEvent struct {
	ID              string `mapstructure:"cloudevent.id"`
	Data            []byte `mapstructure:"-"` // cannot be overridden
	Topic           string `mapstructure:"-"` // cannot be overridden
	Pubsub          string `mapstructure:"-"` // cannot be overridden
	DataContentType string `mapstructure:"-"` // cannot be overridden
	TraceID         string `mapstructure:"cloudevent.traceid"`
	TraceState      string `mapstructure:"cloudevent.tracestate"`
	Source          string `mapstructure:"cloudevent.source"`
	Type            string `mapstructure:"cloudevent.type"`
	TraceParent     string `mapstructure:"cloudevent.traceparent"`
}

CloudEvent is a request object to create a Dapr compliant cloudevent. The cloud event properties can manually be overwritten by using metadata beginning with "cloudevent." as prefix.

type Expr added in v1.4.0

type Expr interface {
	Eval(variables map[string]interface{}) (interface{}, error)
}

type NotAllowedError added in v1.0.0

type NotAllowedError struct {
	Topic string
	ID    string
}

pubsub.NotAllowedError is returned by the runtime when publishing is forbidden.

func (NotAllowedError) Error added in v1.0.0

func (e NotAllowedError) Error() string

type NotFoundError added in v1.0.0

type NotFoundError struct {
	PubsubName string
}

pubsub.NotFoundError is returned by the runtime when the pubsub does not exist.

func (NotFoundError) Error added in v1.0.0

func (e NotFoundError) Error() string

type RoutesJSON added in v1.4.0

type RoutesJSON struct {
	Rules   []*RuleJSON `json:"rules,omitempty"`
	Default string      `json:"default,omitempty"`
}

type Rule added in v1.4.0

type Rule struct {
	Match Expr   `json:"match"`
	Path  string `json:"path"`
}

type RuleJSON added in v1.4.0

type RuleJSON struct {
	Match string `json:"match"`
	Path  string `json:"path"`
}

type Subscription

type Subscription struct {
	PubsubName      string            `json:"pubsubname"`
	Topic           string            `json:"topic"`
	DeadLetterTopic string            `json:"deadLetterTopic"`
	Metadata        map[string]string `json:"metadata"`
	Rules           []*Rule           `json:"rules,omitempty"`
	Scopes          []string          `json:"scopes"`
	BulkSubscribe   *BulkSubscribe    `json:"bulkSubscribe"`
}

func DeclarativeKubernetes added in v0.11.0

func DeclarativeKubernetes(ctx context.Context, client operatorv1pb.OperatorClient, podName string, namespace string, log logger.Logger) []Subscription

DeclarativeKubernetes loads subscriptions from the operator when running in Kubernetes.

func DeclarativeLocal added in v1.11.0

func DeclarativeLocal(resourcesPaths []string, namespace string, log logger.Logger) (subs []Subscription)

DeclarativeLocal loads subscriptions from the given local resources path.

func GetSubscriptionsHTTP

func GetSubscriptionsHTTP(ctx context.Context, channel channel.AppChannel, log logger.Logger, r resiliency.Provider) ([]Subscription, error)

type SubscriptionJSON added in v1.4.0

type SubscriptionJSON struct {
	PubsubName      string            `json:"pubsubname"`
	Topic           string            `json:"topic"`
	DeadLetterTopic string            `json:"deadLetterTopic"`
	Metadata        map[string]string `json:"metadata,omitempty"`
	Route           string            `json:"route"`  // Single route from v1alpha1
	Routes          RoutesJSON        `json:"routes"` // Multiple routes from v2alpha1
	BulkSubscribe   BulkSubscribeJSON `json:"bulkSubscribe,omitempty"`
}

Jump to

Keyboard shortcuts

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