pubsub

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: Apache-2.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLocalPubSub

func NewLocalPubSub(id string) *localPubSub

func NewNatsPubSub

func NewNatsPubSub(id string) *natsPubSub

Types

type Message

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

func NewMessage

func NewMessage(data interface{}) *Message

func (*Message) Ack

func (m *Message) Ack() error

func (*Message) Data

func (m *Message) Data() interface{}

func (*Message) SetAckFunc

func (m *Message) SetAckFunc(f func() error)

func (*Message) SetTopic

func (m *Message) SetTopic(topic Topic)

func (*Message) String

func (m *Message) String() string

func (*Message) Topic

func (m *Message) Topic() Topic

type PubSub

type PubSub interface {
	Publish(ctx context.Context, topic Topic, msg *Message) error
	Subscribe(ctx context.Context, topic Topic) (ch <-chan *Message, unsubscribe func())
}

type Topic

type Topic string

Jump to

Keyboard shortcuts

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