pubsub

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

* Copyright 2024 Kapeta Inc. * SPDX-License-Identifier: MIT

* Copyright 2024 Kapeta Inc. * SPDX-License-Identifier: MIT

* Copyright 2024 Kapeta Inc. * SPDX-License-Identifier: MIT

* Copyright 2024 Kapeta Inc. * SPDX-License-Identifier: MIT

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

type Consumer[T any] struct {
	// contains filtered or unexported fields
}

func CreateConsumer

func CreateConsumer[T any, Attributes map[string]string](config providers.ConfigProvider, resourceName string, handler MessageHandler[T, map[string]string]) (*Consumer[T], error)

func (*Consumer[T]) ReceiveMessages

func (c *Consumer[T]) ReceiveMessages(ctx context.Context)

type MessageHandler

type MessageHandler[T any, Attributes map[string]string] func(message T, Attributes map[string]string) error

type PubSubBlockDefinition

type PubSubBlockDefinition struct {
	Kind     string          `json:"kind"`
	Metadata model.Metadata  `json:"metadata"`
	Spec     PubSubBlockSpec `json:"spec"`
}

type PubSubBlockSpec

type PubSubBlockSpec struct {
	Providers []PubSubProviderConsumer `json:"providers"`
	Consumers []PubSubProviderConsumer `json:"consumers"`
}

type PubSubProviderConsumer

type PubSubProviderConsumer struct {
	Metadata model.ResourceMetadata      `json:"metadata"`
	Spec     PubSubTopicSubscriptionSpec `json:"spec"`
}

type PubSubTopicSubscriptionSpec

type PubSubTopicSubscriptionSpec struct {
	Topic        string `json:"topic"`
	Subscription string `json:"subscription"`
}

type Publisher

type Publisher[DataType any, Headers map[string]string] struct {
	// contains filtered or unexported fields
}

func CreatePublisher

func CreatePublisher[DataType any, Headers map[string]string](config providers.ConfigProvider, resourceName string) (*Publisher[DataType, Headers], error)

func (*Publisher[DataType, Headers]) Close added in v0.1.1

func (p *Publisher[DataType, Headers]) Close() error

func (*Publisher[DataType, Headers]) Publish

func (p *Publisher[DataType, Headers]) Publish(payload PublisherPayload[DataType, Headers]) (string, error)

type PublisherPayload

type PublisherPayload[DataType any, Headers map[string]string] struct {
	DataType DataType          `json:"data"`
	Headers  map[string]string `json:"headers"`
}

Jump to

Keyboard shortcuts

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