emitter

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NatsName                string        = "GUAC"
	StreamName              string        = "DOCUMENTS"
	StreamSubjects          string        = "DOCUMENTS.*"
	SubjectNameDocCollected string        = "DOCUMENTS.collected"
	SubjectNameDocProcessed string        = "DOCUMENTS.processed"
	SubjectNameDocParsed    string        = "DOCUMENTS.parsed"
	DurableProcessor        string        = "processor"
	DurableIngestor         string        = "ingestor"
	BufferChannelSize       int           = 1000
	BackOffTimer            time.Duration = 1 * time.Second
)

NATS stream

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) nats.JetStreamContext

FromContext allows for the JetStreamContext to be pulled from the context

func NewJetStream

func NewJetStream(url string, creds string, nKeyFile string) *jetStream

NewJetStream initializes jetStream to connect to NATS

func NewPubSub

func NewPubSub(ctx context.Context, id string, subj string, durable string, backOffTimer time.Duration) (*pubSub, error)

NewPubSub initializes the subscriber via the valid subject and durable string. Returning a dataChan and errChan to fetch data on the stream

func Publish

func Publish(ctx context.Context, subj string, data []byte) error

Publish publishes the data onto the NATS stream for consumption by upstream services

Types

type DataFunc

type DataFunc func([]byte) error

DataFunc determines how the data return from NATS is transformed based on implementation per module

Jump to

Keyboard shortcuts

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