subscription

package
v0.0.0-...-ed06964 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

func NewManager

func NewManager() *Manager

func (*Manager) Publish

func (m *Manager) Publish(resourceID string, message any)

func (*Manager) PublishUpdate

func (m *Manager) PublishUpdate(message Message)

func (*Manager) Subscribe

func (m *Manager) Subscribe(resourceID string, subscriber Subscriber)

func (*Manager) Unsubscribe

func (m *Manager) Unsubscribe(resourceID string, subscriptionID string)

type Message

type Message struct {
	ResourceID string
	Type       string
	Content    interface{}
}

type Subscriber

type Subscriber interface {
	ID() string
	Notify(message Message) error
}

func NewSubscriberFunction

func NewSubscriberFunction(function func(Message) error) Subscriber

type SubscriberFunction

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

func (*SubscriberFunction) ID

func (sf *SubscriberFunction) ID() string

func (*SubscriberFunction) Notify

func (sf *SubscriberFunction) Notify(message Message) error

type Subscription

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

Subscription represents a group of subscribers that are waiting for updates of a specific resource

Jump to

Keyboard shortcuts

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