-
Notifications
You must be signed in to change notification settings - Fork 1
/
redis.go
34 lines (31 loc) · 1.13 KB
/
redis.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Package redispubsub provides an implementation of pubsub for Redis.
// It requires a minimum Redis version of 6.x for Streams support.
//
// redispubsub does not support Message.Nack; Message.Nackable will return
// false, and Message.Nack will panic if called.
//
// # URLs
//
// For pubsub.OpenTopic and pubsub.OpenSubscription, redispubsub registers
// for the scheme "redis".
// The default URL opener will connect to a Redis Server based
// on the environment variable "REDIS_URL", expected to
// server address like "redis://<user>:<pass>@localhost:6379/<db>".
// To customize the URL opener, or for more details on the URL format,
// see URLOpener.
// See https://gocloud.dev/concepts/urls/ for background information.
//
// # Escaping
//
// Go CDK supports all UTF-8 strings. No escaping is required for Redis.
package redispubsub
import (
"gocloud.dev/pubsub"
)
func init() {
opener := new(defaultOpener)
pubsub.DefaultURLMux().RegisterTopic(Scheme, opener)
pubsub.DefaultURLMux().RegisterSubscription(Scheme, opener)
}
// Scheme is the URL scheme that redispubsub registers its URLOpeners under on pubsub.DefaultMux.
const Scheme = "redis"