diff --git a/tutorevent_bus_redis/patches/openedx-common-settings b/tutorevent_bus_redis/patches/openedx-common-settings new file mode 100644 index 0000000..5629470 --- /dev/null +++ b/tutorevent_bus_redis/patches/openedx-common-settings @@ -0,0 +1,12 @@ +# redis connection url +# https://redis.readthedocs.io/en/stable/examples/ssl_connection_examples.html#Connecting-to-a-Redis-instance-via-a-URL-string +EVENT_BUS_REDIS_CONNECTION_URL = "redis://{% if REDIS_USERNAME and REDIS_PASSWORD %}{{ REDIS_USERNAME }}:{{ +REDIS_PASSWORD }}{% endif %}@{{ REDIS_HOST }}:{{ REDIS_PORT }}/" +EVENT_BUS_TOPIC_PREFIX = "{{ EVENT_BUS_REDIS_TOPIC_PREFIX }}" +EVENT_BUS_PRODUCER = "{{ EVENT_BUS_REDIS_PRODUCER }}" +EVENT_BUS_CONSUMER = "{{ EVENT_BUS_REDIS_CONSUMER }}" +{% if EVENT_BUS_REDIS_CONSUMER_CONSECUTIVE_ERRORS_LIMIT %} +EVENT_BUS_REDIS_CONSUMER_CONSECUTIVE_ERRORS_LIMIT = int("{{ EVENT_BUS_REDIS_CONSUMER_CONSECUTIVE_ERRORS_LIMIT }}") +{% endif %} +EVENT_BUS_REDIS_CONSUMER_POLL_TIMEOUT = int("{{ EVENT_BUS_REDIS_CONSUMER_POLL_TIMEOUT }}") +EVENT_BUS_REDIS_STREAM_MAX_LEN = int("{{ EVENT_BUS_REDIS_STREAM_MAX_LEN }}") diff --git a/tutorevent_bus_redis/patches/openedx-dockerfile-post-python-requirements b/tutorevent_bus_redis/patches/openedx-dockerfile-post-python-requirements new file mode 100644 index 0000000..6fdb46f --- /dev/null +++ b/tutorevent_bus_redis/patches/openedx-dockerfile-post-python-requirements @@ -0,0 +1 @@ +edx-event-bus-redis=={{ EVENT_BUS_REDIS_RELEASE }} diff --git a/tutorevent_bus_redis/plugin.py b/tutorevent_bus_redis/plugin.py index 18b6e66..0c652f5 100644 --- a/tutorevent_bus_redis/plugin.py +++ b/tutorevent_bus_redis/plugin.py @@ -20,6 +20,33 @@ # Each new setting is a pair: (setting_name, default_value). # Prefix your setting names with 'EVENT_BUS_REDIS_'. ("EVENT_BUS_REDIS_VERSION", __version__), + + # Version of https://github.com/openedx/event-bus-redis to install + # TODO: support forks + ("EVENT_BUS_REDIS_RELEASE", "0.3.2"), + + # Prefix for topics sent over the event bus + ("EVENT_BUS_REDIS_TOPIC_PREFIX", "openedx"), + + # Producer class which can send events to redis streams. + ("EVENT_BUS_REDIS_PRODUCER", "edx_event_bus_redis.create_producer"), + + # Consumer class which can consume events from redis streams. + ("EVENT_BUS_REDIS_CONSUMER", "edx_event_bus_redis.RedisEventConsumer"), + + # If the consumer encounters this many consecutive errors, exit with an error. This is intended to be used in a + # context where a management system (such as Kubernetes) will relaunch the consumer automatically. + # Default is "None", which means the consumer will never relaunch. + ("EVENT_BUS_REDIS_CONSUMER_CONSECUTIVE_ERRORS_LIMIT", 0), + + # How long the consumer should wait for new entries in a stream. + # As we are running the consumer in a while True loop, changing this setting doesn't make much difference expect + # for changing number of monitoring messages while waiting for new events. + # https://redis.io/commands/xread/#blocking-for-data + ("EVENT_BUS_REDIS_CONSUMER_POLL_TIMEOUT", 60), + + # Limits stream size to approximately this number + ("EVENT_BUS_REDIS_STREAM_MAX_LEN", 10_000), ] )