kubemq

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2021 License: MIT Imports: 9 Imported by: 1

README

kubemq

GitHub Actions GitHub release (latest by date) GitHub pull requests GitHub All Releases

LICENSE Coverage Status codebeat badge goreportcard badge

Download:

go get github.com/sparetimecoders/kubemq

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Host string
	Port int
}

Config holds the connection configuration

type Connection

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

Connection is a wrapper around the actual kubemq.Connection

func New

func New(serviceName string, config Config, log Log) *Connection

New creates a new Connection

func (*Connection) Close

func (c *Connection) Close() error

Close closes the kubemq connection

func (*Connection) Start

func (c *Connection) Start(ctx context.Context, opts ...Setup) error

Start setups the connection and configurations for Kubemq TODO Really pass context in and expose ut? Or just use it internally (in Close?)

type HandlerFn

type HandlerFn func(interface{}) error

HandlerFn is used process incoming messages

type Log

type Log interface {
	Debug(string)
	Info(string)
	Warn(string)
	Error(string)
	Fatal(string)
	Debugf(string, ...interface{})
	Infof(string, ...interface{})
	Warnf(string, ...interface{})
	Errorf(string, ...interface{})
	Fatalf(string, ...interface{})
}

Log represents the API for a logger

type NopLogger

type NopLogger struct{}

NopLogger ignores all function calls

func (NopLogger) Debug

func (n NopLogger) Debug(s string)

Debug level message.

func (NopLogger) Debugf

func (n NopLogger) Debugf(s string, i ...interface{})

Debugf level formatted message.

func (NopLogger) Error

func (n NopLogger) Error(s string)

Error level message.

func (NopLogger) Errorf

func (n NopLogger) Errorf(s string, i ...interface{})

Errorf level formatted message.

func (NopLogger) Fatal

func (n NopLogger) Fatal(s string)

Fatal level message.

func (NopLogger) Fatalf

func (n NopLogger) Fatalf(s string, i ...interface{})

Fatalf level formatted message.

func (NopLogger) Info

func (n NopLogger) Info(s string)

Info level message.

func (NopLogger) Infof

func (n NopLogger) Infof(s string, i ...interface{})

Infof level formatted message.

func (NopLogger) Warn

func (n NopLogger) Warn(s string)

Warn level message.

func (NopLogger) Warnf

func (n NopLogger) Warnf(s string, i ...interface{})

Warnf level formatted message.

type Publisher

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

Publisher is used to send messages

func (*Publisher) Publish

func (p *Publisher) Publish(ctx context.Context, msg interface{}, delay time.Duration) error

Publish publishes a message to a queue

type Setup

type Setup func(conn *Connection) error

Setup is a setup function that takes a Connection and configures it

func NewWorkQueue

func NewWorkQueue(p *Publisher, h HandlerFn, queueNameSuffix string, typeTags ...TypeTag) Setup

NewWorkQueue creates a new work queue. A Publisher is used to add work to the queue and the HandlerFn processes work (incoming messages) The TypeTag splice is used to determine which events are possible to send and process by this work queue

type TypeTag

type TypeTag struct {
	Type interface{}
	Tag  string
}

TypeTag defines the tag to be used for a message type

Jump to

Keyboard shortcuts

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