Crate generic_db_observer
source ·Expand description
§generic-db-observer
A generic observer that monitors a database for changes (currently only Redis is supported) and then triggers a change in some Event Subject.
To create a program based on this library, you need to implement EventSubject
, and then run the function ObserverConfig::run_observer
.
§Limitations:
- Redis PubSub doesn’t actually tell us which channels are added or left, instead we receive a notification that “something has changed”, and then we have to load the entire set of tracked channels and compare it with which channels are currently joined. This probably causes quite a performance hit.
- The Event Subject connection is expected to be blocking, whereas the Database connection is expected to be async.
Re-exports§
pub use observer::EventSubject;
pub use observer::MsgListener;
pub use observer_config::ObserverConfig;
Modules§
- This module provides an interface connecting all components of the program: Traits for Event Subject and Message Broker are defined, facilitating a main loop function based on these abstractions.
- A structure representing a configuration for an observer that includes an event subject and a message broker.
- This module allows us to set a connection to Redis as a Listener.