redis

package
v0.0.0-...-5352646 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package redis implements an events.PubSub implementation that uses Redis PubSub.

Example
package main

import (
	"go.thethings.network/lorawan-stack/pkg/events"
	"go.thethings.network/lorawan-stack/pkg/events/redis"

	ttnredis "go.thethings.network/lorawan-stack/pkg/redis"
)

func main() {
	// This sends all events received from Redis to the default pubsub.
	redisPubSub := redis.WrapPubSub(events.DefaultPubSub(), ttnredis.Config{
		// Config here...
	})
	// Replace the default pubsub so that we will now publish to Redis.
	events.SetDefaultPubSub(redisPubSub)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PubSub

type PubSub struct {
	events.PubSub
	// contains filtered or unexported fields
}

PubSub with Redis backend.

func NewPubSub

func NewPubSub(conf ttnredis.Config) *PubSub

NewPubSub creates a new PubSub that publishes and subscribes to Redis.

func WrapPubSub

func WrapPubSub(wrapped events.PubSub, conf ttnredis.Config) (ps *PubSub)

WrapPubSub wraps an existing PubSub and publishes all events received from Redis to that PubSub.

func (*PubSub) Close

func (ps *PubSub) Close() error

Close the Redis publisher.

func (*PubSub) Publish

func (ps *PubSub) Publish(evt events.Event)

Publish an event to Redis.

Jump to

Keyboard shortcuts

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