Skip to main content

Redis Configuration

We use Redis in Sendhooks primarily for its streams feature, enabling us to efficiently receive and send webhook status updates. We chose Redis for its speed, security, and low latency, ensuring that webhooks are delivered promptly and reliably.

Why Redis?

We chose Redis because it allows for quick and secure data transmission, reducing latency. This is essential when integrating the Sendhooks engine directly into your application, ensuring that webhooks are delivered as quickly as possible without unnecessary delays. Redis streams are particularly useful for their ability to handle message persistence and recovery, which means if the webhook service is down, it can continue processing messages after restarting without losing data.

Retry Logic

We have implemented a retry mechanism to manage the delivery of webhooks effectively. It uses exponential backoff with a maximum time of 3600 seconds and will retry up to 5 times. This approach ensures that the receiving end is not overwhelmed and can handle cases like timeouts or server unavailability.

Configuration

Configuration for Redis in Sendhooks is done using a config.json file. This file should be placed in your project root and contains all necessary parameters.

Here's an example of the config.json file:

{
"redisAddress": "127.0.0.1:6379",
"redisPassword": "your_password_here",
"redisDb": "0",
"redisSsl": "false",
"redisCaCert": "/path/to/ca_cert.pem",
"redisClientCert": "/path/to/client_cert.pem",
"redisClientKey": "/path/to/client_key.pem",
"redisStreamName": "hooks",
"redisStreamStatusName": "sendhooks-status-updates"
}

Parameters

All parameters are optional as there are default values provided. However, if redisSsl is set to true, then redisCaCert, redisClientCert, and redisClientKey are required.

  • redisAddress: Specifies the Redis server address. Default is 127.0.0.1:6379.
  • redisDb: Specifies the Redis database to be used. Default is 0.
  • redisPassword: Optional. Used to set a password for accessing Redis. No default value.
  • redisSsl: Boolean value to enable or disable SSL/TLS. Default is false.
  • redisCaCert, redisClientCert, redisClientKey: Required when redisSsl is true. Set these to the paths of the respective SSL/TLS certificates.
  • redisStreamName: Specifies the Redis stream to be used for webhook data. Default is hooks.
  • redisStreamStatusName: Specifies the Redis stream to be used for status updates. Default is sendhooks-status-updates.

SSL/TLS Configuration

If redisSsl is set to true, ensure that redisCaCert, redisClientCert, and redisClientKey are correctly set to the paths of the necessary certificates to establish a secure connection.