NSQ

Scale applications based on NSQ topic/channel depth.

Availability: v2.17+ Maintainer: Community

Suggest a change

Warning

You are currently viewing v"2.17" of the documentation and it is not the latest. For the most recent documentation, kindly click here.

Trigger Specification

This specification describes the nsq trigger that scales based on NSQ topic/channel depth.

triggers:
- type: nsq
  metadata:
    nsqLookupdHTTPAddresses: "nsq-nsqlookupd.nsq:4161"
    topic: "example_topic"
    channel: "example_channel"
    depthThreshold: "10"
    activationDepthThreshold: "0"
    useHttps: "false"
    unsafeSsl: "false"

Parameter list:

  • nsqLookupdHTTPAddresses - Comma separated list of nsqlookupd HTTP addresses in the form <hostname>:<port>.
  • topic - Name of the NSQ datastream that the channel relates to.
  • channel - Name of the channel used to calculate depth.
  • depthThreshold - Target value for depth to trigger scaling actions. (Default 10, Optional)
  • activationDepthThreshold - Target value for depth to activate the scaler. (Default 0, Optional)
  • useHttps - Use HTTPS instead of HTTP when communicating with NSQ. (Values: true, false, Default: false, Optional)
  • unsafeSsl - Skip certificate validation when connecting over HTTPS. (Values: true, false, Default: false, Optional)

Notice:

  • Since “channels are created on first use by subscribing to the named channel”, the topic depth is used instead of the channel depth when the channel does not yet exist on an nsqd instance. This allows KEDA to effectively bootstrap new channels when the minReplicaCount is 0.
  • If the message flow for a channel is paused, KEDA will not scale up consumers of the channel, regardless of the depth.

Example

apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: nsq-scaledobject
spec:
  scaleTargetRef:
    name: nsq-consumer-deployment
  triggers:
  - type: nsq
    metadata:
      nsqLookupdHTTPAddresses: "nsq-nsqlookupd.nsq:4161"
      topic: "example_topic"
      channel: "example_channel"
      depthThreshold: "10"
      activationDepthThreshold: "0"