Skip to content

Examples Gallery

PSPF includes several working examples to help you understand different patterns and features. All examples are located in the examples/ directory.

Basic Valkey Demo

File: examples/valkey_demo.py
Description: Shows a producer and consumer running in a single process using Valkey. Perfect for testing your local setup. - Run: python examples/valkey_demo.py

Stateful Word Count

File: examples/stateful_wordcount.py
Description: Demonstrates stateful stream processing using the SQLiteStateStore. It counts occurrences of words in a simulated stream. - Run: python examples/stateful_wordcount.py

High Availability (HA) Demo

File: examples/ha_demo.py
Description: Advanced demo showing leader election and log replication across multiple nodes. - Run: python examples/ha_demo.py

Memory Backend Verification

File: examples/verify_memory.py
Description: A lightweight validation script that uses the MemoryBackend to test processor logic without external dependencies. - Run: python examples/verify_memory.py

  • Run: python examples/verify_refactor.py

Chaos Stress-Test Demo

File: examples/chaos_demo.py
Description: A heavy-duty stress test that spawns and kills workers randomly to verify the framework's fault-tolerance and consumer-group rebalancing. - Run: python examples/chaos_demo.py