messaging

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2017 License: Apache-2.0 Imports: 5 Imported by: 0

README

Messaging

The package contains the implementation of a front-end for messaging systems. Currently, only kafka is supported.

Documentation

Overview

Package messaging is the parent package for implementations of various messaging clients, e.g. Kafka.

Index

Constants

View Source
const DefaultMsgTimeout = 2 * time.Second

DefaultMsgTimeout for delivery of notification

Variables

This section is empty.

Functions

func ParseOpts

func ParseOpts(opts ...interface{}) (time.Duration, logging.Logger)

ParseOpts returns timeout and logger to be used based on the given options.

func ToProtoMsgChan

func ToProtoMsgChan(ch chan ProtoMessage, opts ...interface{}) func(ProtoMessage)

ToProtoMsgChan allows to receive messages through channel instead of callback.

func ToProtoMsgErrChan

func ToProtoMsgErrChan(ch chan ProtoMessageErr, opts ...interface{}) func(ProtoMessageErr)

ToProtoMsgErrChan allows to receive error messages through channel instead of callback.

Types

type Mux

type Mux interface {
	NewSyncPublisher(topic string) ProtoPublisher
	NewAsyncPublisher(topic string, successClb func(ProtoMessage), errorClb func(err ProtoMessageErr)) ProtoPublisher
	NewWatcher(subscriberName string) ProtoWatcher
}

Mux defines API for the plugins that use access to kafka brokers.

type ProtoMessage

type ProtoMessage interface {
	keyval.ProtoKvPair
	GetTopic() string
}

ProtoMessage defines functions for inspection of a message receive from messaging system.

type ProtoMessageErr

type ProtoMessageErr interface {
	ProtoMessage
	Error() error
}

ProtoMessageErr represents a message that was not published successfully to a messaging system.

type ProtoPublisher

type ProtoPublisher interface {
	datasync.KeyProtoValWriter
}

ProtoPublisher allows to publish a message of type proto.Message into messaging system.

type ProtoWatcher

type ProtoWatcher interface {
	Watch(msgCallback func(ProtoMessage), topics ...string) error
	StopWatch(topic string) error
}

ProtoWatcher allows to subscribe for receiving of messages published to given topics.

type WithLoggerOpt

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

WithLoggerOpt defines a logger that logs if delivery of notification is unsuccessful.

func WithLogger

func WithLogger(logger logging.Logger) *WithLoggerOpt

WithLogger creates an option for ToChan function that specifies a logger to be used.

type WithTimeoutOpt

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

WithTimeoutOpt defines the maximum time that is attempted to deliver notification.

func WithTimeout

func WithTimeout(timeout time.Duration) *WithTimeoutOpt

WithTimeout creates an option for ToChan function that defines a timeout for notification delivery.

Directories

Path Synopsis
Package kafka implements a client for the Kafka broker.
Package kafka implements a client for the Kafka broker.
client
Package client implements the synchronous and asynchronous kafka Producers and the kafka Consumer.
Package client implements the synchronous and asynchronous kafka Producers and the kafka Consumer.
mux
Package mux implements the session multiplexer that allows multiple plugins to share a single connection to a Kafka broker.
Package mux implements the session multiplexer that allows multiple plugins to share a single connection to a Kafka broker.

Jump to

Keyboard shortcuts

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