Skip to content

Commit 53ef836

Browse files
authored
chore: add sentinel example (#61)
* chore: add sentinel example * chore: update README.md
1 parent b8fdfc5 commit 53ef836

10 files changed

Lines changed: 317 additions & 52 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
- *chore*: add sentinel example
11+
1012
## [1.0.0-rc.6] - 2026-04-09
1113

1214
- *bump*: Bump to v1.0.0-rc.7 (#58)

Cargo.lock

Lines changed: 37 additions & 35 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ apalis-board = { version = "1.0.0-rc.6", features = ["axum"] }
5050
axum = { version = "0.8", features = ["macros", "json"] }
5151
tracing-subscriber = { version = "0.3.11", features = ["env-filter"] }
5252
tracing = "0.1"
53+
redis = { version = "1.0.4", default-features = false, features = [
54+
"sentinel",
55+
] }
5356

5457
[features]
5558
default = ["tokio-comp"]

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Background task processing for rust using `apalis` and `redis`
66

77
- **Reliable task queue** using any `redis` compatible service as the backend.
88
- **Multiple storage types**: standard polling and `pubsub` based approaches.
9+
- **Supports Redis Sentinel**: offering high availability.
910
- **Customizable codecs** for serializing/deserializing task arguments such as `json`, `msgpack` and `bincode`.
1011
- **Heartbeat and orphaned tasks re-enqueueing** for consistent task processing.
1112
- **Integration with `apalis` workers and middleware** such as `retry`, `long_running` and `parallelize`

examples/sentinel/.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
HOST_IP=

examples/sentinel/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
data
2+
.env

examples/sentinel/README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Sentinel + Apalis Redis
2+
3+
This example covers the basics of setting up redis-sentinel and apalis-redis offering high availability.
4+
5+
## Getting started
6+
7+
> Setup your sentinel infra. In this example we will follow the example provided [here](https://medium.com/@mohsenmahoski/setting-up-sentinel-with-docker-compose-5cad962c7643)
8+
9+
10+
### Running locally
11+
12+
Create a .env file with your host IP:
13+
14+
```env
15+
HOST_IP=
16+
```
17+
18+
I used this command:
19+
20+
```bash
21+
ipconfig getifaddr en0
22+
```
23+
24+
Run docker compose:
25+
26+
```bash
27+
docker-compose --env-file .env up
28+
```
29+
30+
Now start the worker
31+
32+
```bash
33+
SENTINEL_NODES=redis://127.0.0.1:26379,redis://127.0.0.1:26380,redis://127.0.0.1:26381 cargo run cargo run --example sentinel
34+
```

0 commit comments

Comments
 (0)