zmq

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const MonitorSocketAddr = "inproc://zmq_socket_monitor.rep"

MonitorSocketAddr is the address at which the socket monitor connects to the ZMQ publisher socket.

Variables

This section is empty.

Functions

func NewProducer

func NewProducer(ctx context.Context, config *Config, metrics metrics.MetricCollector, namespace string, airbrakeHandler *airbrake.AirbrakeHandler, ackChan chan (*telemetry.Record), reliableAckTxTypes map[string]interface{}, logger *logrus.Logger) (producer telemetry.Producer, err error)

NewProducer creates a ZMQProducer with the given config.

Types

type Config

type Config struct {
	// Addr is the address to which to producer will attempt to bind.
	Addr string `json:"addr"`

	// ServerKeyJSONPath is the path to a file which contains the server's secret
	// key as a json. This key can be generated using zmq4.NewCurveKeypair
	ServerKeyJSONPath string `json:"server_key_json_path"`

	// AllowedPublicKeysJSONPath is the path to a file which contains a list of
	// allowed public keys for client connections. This field is optional.
	AllowedPublicKeysJSONPath string `json:"allowed_public_keys_json_path"`

	// Verbose controls if verbose logging is enabled for the socket.
	Verbose bool `json:"verbose"`
}

Config contains the data necessary to configure a zmq producer.

type KeyJSON

type KeyJSON struct {
	// Secret is the secret key encoded as a 40 char z85 string.
	Secret string `json:"secret"`

	// Public is the public key encoded as a 40 char z85 string.
	Public string `json:"public"`
}

KeyJSON contains z85 key data

type Metrics

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

Metrics stores metrics reported from this package

type ZMQProducer

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

ZMQProducer implements the telemetry.Producer interface by publishing to a bound zmq socket.

func (*ZMQProducer) Close

func (p *ZMQProducer) Close() error

Close the underlying socket.

func (*ZMQProducer) ProcessReliableAck added in v0.3.0

func (p *ZMQProducer) ProcessReliableAck(entry *telemetry.Record)

ProcessReliableAck sends to ackChan if reliable ack is configured

func (*ZMQProducer) Produce

func (p *ZMQProducer) Produce(rec *telemetry.Record)

Publish the record to the socket.

func (*ZMQProducer) ReportError added in v0.1.14

func (p *ZMQProducer) ReportError(message string, err error, logInfo logrus.LogInfo)

ReportError to airbrake and logger

Jump to

Keyboard shortcuts

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