pipe

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2021 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NATSPipe

type NATSPipe struct {
	CMQ    *cmq.CMQ
	NATS   *cmq.CMQ
	Tracer trace.Tracer
	Logger *zap.Logger
}

func (*NATSPipe) Pipe

func (p *NATSPipe) Pipe(topic, group string)

Pipe start piping messages from nats to jetstream based on given topic.

type Pipe

type Pipe interface {
	Pipe(topic, group string)
}

Pipe interface pipes data from input to output. it has streaming to jetstream or nats to jetstream implementation. please note that we always use queue subscription so you need to specify the group id.

func NewNATS

func NewNATS(c *cmq.CMQ, n *cmq.CMQ, logger *zap.Logger, tracer trace.Tracer) Pipe

New create pipe to pipe data from nats to jetstream. you can use a single pipe instance for mutiple topics.

func NewSTAN

func NewSTAN(c *cmq.CMQ, s *streaming.Streaming, logger *zap.Logger, tracer trace.Tracer) Pipe

New create pipe to pipe data from streaming to jetstream. you can use a single pipe instance for mutiple topics.

type Piped

type Piped struct {
	PipedMessages  prometheus.Counter
	FailedMessages prometheus.Counter
}

Piped contains metrics to meter the number of piped messages.

func NewPiped

func NewPiped(name string) Piped

NewPiped creates piped metrics based on topic name with const labels.

type STANPipe

type STANPipe struct {
	CMQ       *cmq.CMQ
	Streaming *streaming.Streaming
	Tracer    trace.Tracer
	Logger    *zap.Logger
}

func (*STANPipe) Pipe

func (p *STANPipe) Pipe(topic, group string)

Pipe start piping messages from streaming to jetstream based on given topic. its subscription on streaming isn't durable and it always start from 1 second behind. the reason here is to reduce load on the streaming server as much as possible.

Jump to

Keyboard shortcuts

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