pubsub

package
v1.29.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: Apache-2.0 Imports: 8 Imported by: 4

Documentation

Overview

Package pubsub provides a foundation for implementing pub/sub clients for various message brokers such as google pub-sub, kafka and MQTT. It defines interfaces for publishing and subscribing to messages, managing topics, and handling messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Publisher
	Subscriber
	Health() datasource.Health

	CreateTopic(context context.Context, name string) error
	DeleteTopic(context context.Context, name string) error

	Close() error
}

type Committer

type Committer interface {
	Commit()
}

type Log added in v1.5.0

type Log struct {
	Mode          string `json:"mode"`
	CorrelationID string `json:"correlationID"`
	MessageValue  string `json:"messageValue"`
	Topic         string `json:"topic"`
	Host          string `json:"host"`
	PubSubBackend string `json:"pubSubBackend"`
	Time          int64  `json:"time"`
}

func (*Log) PrettyPrint added in v1.5.0

func (l *Log) PrettyPrint(writer io.Writer)

type Logger

type Logger interface {
	Debugf(format string, args ...interface{})
	Debug(args ...interface{})
	Logf(format string, args ...interface{})
	Log(args ...interface{})
	Errorf(format string, args ...interface{})
	Error(args ...interface{})
}

type Message

type Message struct {
	Topic    string
	Value    []byte
	MetaData interface{}

	Committer
	// contains filtered or unexported fields
}

func NewMessage

func NewMessage(ctx context.Context) *Message

func (*Message) Bind

func (m *Message) Bind(i any) error

Bind binds the message value to the input variable. The input should be a pointer to a variable.

func (*Message) Context

func (m *Message) Context() context.Context

func (*Message) HostName

func (*Message) HostName() string

func (*Message) Param

func (m *Message) Param(p string) string

func (*Message) Params added in v1.16.0

func (*Message) Params(string) []string

func (*Message) PathParam

func (m *Message) PathParam(p string) string

type Publisher

type Publisher interface {
	Publish(ctx context.Context, topic string, message []byte) error
}

type Subscriber

type Subscriber interface {
	Subscribe(ctx context.Context, topic string) (*Message, error)
}

Directories

Path Synopsis
eventhub module
Package google provides a client for interacting with Google Cloud Pub/Sub.This package facilitates interaction with Google Cloud Pub/Sub, allowing publishing and subscribing to topics, managing subscriptions, and handling messages.
Package google provides a client for interacting with Google Cloud Pub/Sub.This package facilitates interaction with Google Cloud Pub/Sub, allowing publishing and subscribing to topics, managing subscriptions, and handling messages.
Package kafka provides a client for interacting with Apache Kafka message queues.This package facilitates interaction with Apache Kafka, allowing publishing and subscribing to topics, managing consumer groups, and handling messages.
Package kafka provides a client for interacting with Apache Kafka message queues.This package facilitates interaction with Apache Kafka, allowing publishing and subscribing to topics, managing consumer groups, and handling messages.
Package mqtt provides a client for interacting with MQTT message brokers.This package facilitates interaction with MQTT brokers, allowing publishing and subscribing to topics, managing subscriptions, and handling messages.
Package mqtt provides a client for interacting with MQTT message brokers.This package facilitates interaction with MQTT brokers, allowing publishing and subscribing to topics, managing subscriptions, and handling messages.
nats module

Jump to

Keyboard shortcuts

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