Skip to content

redis://

Redis integration via go-redis/v9, backing ~98 commands across strings, hashes, lists, sets, sorted-sets, pub/sub, geo, and server-info families. Supports standalone, cluster, and sentinel topologies, with TLS / mTLS, connection pooling, and Helix-Reconnector-driven retry. Both producer and consumer roles are supported — consumers are SUBSCRIBE / PSUBSCRIBE-only.

URI shape

Producer (key-based ops):
  redis://<key>?addr=host:6379&command=GET&...

Producer (channel publish):
  redis://<channel>?addr=host:6379&command=PUBLISH&...

Consumer (subscribe):
  redis://<channel>?addr=host:6379&command=SUBSCRIBE
  redis://<pattern>?addr=host:6379&command=PSUBSCRIBE

The path segment is the Redis key for key-based ops, the channel for PUBLISH, or the channel/pattern for subscribers. ?channels= accepts a comma-separated list when a subscriber needs multiple channels/patterns.

Parameters

The component implements engine.Describable. Highlights below; full list lives in Describe() in source.

Path-equivalent

Param Type Default Producer/Consumer/Both Description
command enum required Both Redis command. SUBSCRIBE/PSUBSCRIBE make the endpoint a consumer; everything else is a producer.
channels string (path) Consumer Comma-separated channels / patterns. Falls back to the URI path when empty.

Connection

Param Type Default Both Description
addr string localhost:6379 standalone host:port
host, port string, integer — Aliases (combined to host:port)
clusterAddrs string — Comma-separated cluster nodes — selects Cluster mode
sentinelAddrs string — Sentinel nodes; pair with sentinelMasterName
sentinelMasterName string — Sentinel master-set name
db integer 0 Database number (standalone only)
clientName string — Visible in CLIENT LIST

Auth & TLS

Param Type Default Description
username string — Redis 6+ ACL username
password string — AUTH password (or ACL password)
tls, secure boolean false Force TLS handshake
tlsCAFile, tlsCertFile, tlsKeyFile string — PEM material for mTLS
tlsInsecureSkipVerify boolean false Skip cert verification (staging only)
tlsMinVersion, tlsMaxVersion enum — TLSv1.0…TLSv1.3
tlsCipherSuites string — Go cipher-suite name list

Pool / timeouts

Param Type Default Description
dialTimeout duration 5s Connect timeout
readTimeout duration 3s Per-command read timeout
writeTimeout duration 3s Per-command write timeout
poolSize integer 10 Max pooled connections
minIdleConns integer 0 Min idle conns
maxRetries integer 3 Per-command retries

Producer / reconnect / headers

Param Type Default Description
expirySeconds integer 0 Default TTL for SET/SETNX. Overridable per-message via redis.EXPIRE_SECONDS header.
reconnect boolean true Enable Helix-Reconnector loop on transport errors.
maxReconnectAttempts integer -1 -1 = unlimited
reconnectTimeWait duration 2s Initial backoff
headerIncludePattern, headerExcludePattern string — Regex header filtering

Headers

Each command family reads / writes its own headers — full list lives in pkg/component/redis/headers.go. Common ones:

Header Direction Effect
redis.EXPIRE_SECONDS Read (Producer) Per-message TTL for SET / SETNX, overrides expirySeconds.
redis.KEY Read Override the URI-supplied key per call.
redis.command.result Written Raw go-redis result (where structured output makes sense).
redis.channel, redis.pattern Written (Consumer) The channel a SUBSCRIBE / PSUBSCRIBE message arrived on.

The body shape per command is documented in pkg/component/redis/command_*.go files (one per category).

Examples

GET / SET:

- target: redis://users:42?command=SET&addr=redis.internal:6379&expirySeconds=3600

- target: redis://users:42?command=GET&addr=redis.internal:6379

Cluster + mTLS:

- target: |
    redis://cart:items?command=HSET&clusterAddrs=r1:6379,r2:6379,r3:6379
    &secure=true&tlsCAFile=/etc/redis/ca.pem
    &tlsCertFile=/etc/redis/client.pem&tlsKeyFile=/etc/redis/client-key.pem

Subscribe consumer:

workflows:
  - id: events-sub
    trigger:
      uri: redis://orders.created?command=SUBSCRIBE&addr=redis.internal:6379
    steps:
      - target: direct://process-event

Pattern subscribe (PSUBSCRIBE) with multi-channel fanout:

- trigger:
    uri: redis://_?command=PSUBSCRIBE&channels=metrics.*,events.*&addr=redis:6379

Publish:

- set-body:
    starlang: '{ "id": 42, "ts": now() }'
- target: redis://orders.created?command=PUBLISH&addr=redis:6379

Behavior notes

  • Shared pool — one *ConnPool per component instance. Endpoints reuse client connections when their connection params match (same addr/auth/TLS).
  • Producer vs consumer split — IsConsumerCommand returns true only for SUBSCRIBE and PSUBSCRIBE. Anything else is producer-only; the URI shape is rejected at endpoint creation if you mix them.
  • Reconnector — a connection drop triggers engine.NewReconnector with exponential backoff (initial = reconnectTimeWait). Subscriber goroutines re-subscribe on reconnect; producer calls fail-fast and retry on the next call.
  • DB selection — db=N must be set at endpoint creation. Issuing SELECT N via command=SELECT is explicitly rejected (it would corrupt every other endpoint sharing the connection).
  • Body shape is command-specific — consult pkg/component/redis/command_*.go for what each command expects on the way in and what it sets on the way out.

Source

  • pkg/component/redis/redis.go, config.go, commands.go, producer.go, consumer.go
  • Command implementations: command_strings.go, command_hashes.go, command_lists.go, command_sets.go, command_zsets.go, command_geo.go, command_server.go
  • Headers: headers.go; Security: security.go; Pool: connection_pool.go

See also

  • mongodb, postgres — other Helix-native datastores.
  • memvec — in-process alternative for vector workloads (Redis-Stack isn't required for Helix RAG).