stream

package
v0.0.0-...-533cb74 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const Resource = "SERVER"

Variables

View Source
var (
	RequestTopic = serversv1.Event_REQUEST.String() + "_" + Resource
	EventTopic   = serversv1.Event_EVENT.String() + "_" + Resource
)

Functions

func NewConsumer

func NewConsumer(configMap *kafka.ConfigMap) (*kafka.Consumer, error)

func NewProducer

func NewProducer(configMap *kafka.ConfigMap) (*kafka.Producer, error)

func PublishToAll

func PublishToAll(event *serversv1.Event)

func Shutdown

func Shutdown()

Shutdown tries to close every managed channel and delete it from managed channels slice

Types

type Stream

type Stream struct {
	ID      string                `json:"id"`
	Channel chan *serversv1.Event `json:"channel"`
}

Stream represents a stream for events

func New

func New() *Stream

New is a constructor for new Stream

func (*Stream) Close

func (stream *Stream) Close()

Close tries to close a managed stream channel

func (*Stream) IsClosed

func (stream *Stream) IsClosed() bool

IsClosed returns if the stream is closed or not

Jump to

Keyboard shortcuts

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