chore(release): 1.2.0 [skip ci] # [1.2.0](https://github.com/pycasbin/rabbitmq-watcher/compare/v1.1.0...v1.2.0) (2023-07-10) ### Features * add MSG class for more info ([3d0698b](https://github.com/pycasbin/rabbitmq-watcher/commit/3d0698b1992216d4fd413e5d6f9857d25da3e014)) * track remote branch ([ee34c4c](https://github.com/pycasbin/rabbitmq-watcher/commit/ee34c4cfed6342f6d0732117e9c402528c83e3ab))
Rabbitmq Watcher is the rabbitmq watcher for pycasbin. With this library, Casbin can synchronize the policy with the database in multiple enforcer instances.
pip install casbin-rabbitmq-watcher
import os import casbin from casbin_rabbitmq_watcher import new_watcher def get_examples(path): examples_path = os.path.split(os.path.realpath(__file__))[0] + "/../examples/" return os.path.abspath(examples_path + path) def update_callback_func(msg): ... watcher = new_watcher() watcher.set_update_callback(update_callback_func) e = casbin.Enforcer( get_examples("rbac_model.conf"), get_examples("rbac_policy.csv") ) e.set_watcher(watcher) # update_callback_func will be called e.save_policy()
This project is under Apache 2.0 License. See the LICENSE file for the full license text.