Skip to content

Commit

Permalink
feat!: remove deprecated signal parameter from consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
navinkarkera committed May 23, 2023
1 parent f71ff33 commit 5a098f5
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 46 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ Unreleased

*

[0.3.0] - 2023-05-23
************************************************

Changed
=======
* **BREAKING CHANGE**: Removed deprecated ``signal`` argument from consumer.

[0.2.1] - 2023-05-12
************************************************

Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,17 @@ install_transifex_client: ## Install the Transifex client

## Local test helpers
produce_test_event:
EVENT_BUS_PRODUCER='edx_event_bus_redis.create_producer' EVENT_BUS_REDIS_CONNECTION_URL='redis://:password@localhost:6379/' EVENT_BUS_TOPIC_PREFIX='dev' python manage.py produce_event --signal openedx_events.content_authoring.signals.XBLOCK_DELETED --topic xblock-deleted --key-field None --data '{"xblock_info": {"usage_key": "block-v1:edx+DemoX+Demo_course+type@video+block@UaEBjyMjcLW65gaTXggB93WmvoxGAJa0JeHRrDThk", "block_type": "video"}}'
EVENT_BUS_PRODUCER='edx_event_bus_redis.create_producer' EVENT_BUS_REDIS_CONNECTION_URL='redis://:password@localhost:6379/' EVENT_BUS_TOPIC_PREFIX='dev' python manage.py produce_event --signal openedx_events.content_authoring.signals.XBLOCK_DELETED --topic xblock-status --key-field None --data '{"xblock_info": {"usage_key": "block-v1:edx+DemoX+Demo_course+type@video+block@UaEBjyMjcLW65gaTXggB93WmvoxGAJa0JeHRrDThk", "block_type": "video"}}'

consume_test_event:
EVENT_BUS_CONSUMER='edx_event_bus_redis.RedisEventConsumer' EVENT_BUS_PRODUCER='edx_event_bus_redis.create_producer' EVENT_BUS_REDIS_CONNECTION_URL='redis://:password@localhost:6379/' EVENT_BUS_TOPIC_PREFIX='dev' python manage.py consume_events --signal org.openedx.content_authoring.xblock.deleted.v1 --topic xblock-deleted --group_id test_group --extra '{"consumer_name": "test_group.c1"}'
EVENT_BUS_CONSUMER='edx_event_bus_redis.RedisEventConsumer' EVENT_BUS_PRODUCER='edx_event_bus_redis.create_producer' EVENT_BUS_REDIS_CONNECTION_URL='redis://:password@localhost:6379/' EVENT_BUS_TOPIC_PREFIX='dev' python manage.py consume_events --topic xblock-status --group_id test_group --extra '{"consumer_name": "test_group.c1"}'

multiple_consumer_test_event:
EVENT_BUS_CONSUMER='edx_event_bus_redis.RedisEventConsumer' EVENT_BUS_PRODUCER='edx_event_bus_redis.create_producer' EVENT_BUS_REDIS_CONNECTION_URL='redis://:password@localhost:6379/' EVENT_BUS_TOPIC_PREFIX='dev' python manage.py consume_events --signal org.openedx.content_authoring.xblock.deleted.v1 --topic xblock-deleted --group_id test_group --extra '{"consumer_name": "test_group.c1"}' &
EVENT_BUS_CONSUMER='edx_event_bus_redis.RedisEventConsumer' EVENT_BUS_PRODUCER='edx_event_bus_redis.create_producer' EVENT_BUS_REDIS_CONNECTION_URL='redis://:password@localhost:6379/' EVENT_BUS_TOPIC_PREFIX='dev' python manage.py consume_events --signal org.openedx.content_authoring.xblock.deleted.v1 --topic xblock-deleted --group_id test_group --extra '{"consumer_name": "test_group.c2"}' &
EVENT_BUS_CONSUMER='edx_event_bus_redis.RedisEventConsumer' EVENT_BUS_PRODUCER='edx_event_bus_redis.create_producer' EVENT_BUS_REDIS_CONNECTION_URL='redis://:password@localhost:6379/' EVENT_BUS_TOPIC_PREFIX='dev' python manage.py consume_events --topic xblock-status --group_id test_group --extra '{"consumer_name": "test_group.c1"}' &
EVENT_BUS_CONSUMER='edx_event_bus_redis.RedisEventConsumer' EVENT_BUS_PRODUCER='edx_event_bus_redis.create_producer' EVENT_BUS_REDIS_CONNECTION_URL='redis://:password@localhost:6379/' EVENT_BUS_TOPIC_PREFIX='dev' python manage.py consume_events --topic xblock-status --group_id test_group --extra '{"consumer_name": "test_group.c2"}' &

kill_all_consume_test_events:
pgrep -lf python\ manage.py\ consume_events\ --signal\ org.openedx.content_authoring.xblock.deleted.v1\ --topic\ xblock-deleted\ --group_id\ test_group | cut -d" " -f1 | xargs kill -15
pgrep -lf python\ manage.py\ consume_events\ --topic\ xblock-status\ --group_id\ test_group | cut -d" " -f1 | xargs kill -15

redis-up:
docker compose up
Expand Down
2 changes: 1 addition & 1 deletion edx_event_bus_redis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
from edx_event_bus_redis.internal.consumer import RedisEventConsumer
from edx_event_bus_redis.internal.producer import create_producer

__version__ = '0.2.1'
__version__ = '0.3.0'

default_app_config = 'edx_event_bus_redis.apps.EdxEventBusRedisConfig' # pylint: disable=invalid-name
5 changes: 2 additions & 3 deletions edx_event_bus_redis/internal/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ class RedisEventConsumer(EventBusConsumer):
Attributes:
topic: Topic/stream name.
group_id: consumer group name.
signal: DEPRECATED, will be removed in a future release
consumer_name: unique name for consumer within a group.
last_read_msg_id: Start reading msgs from a specific redis msg id.
check_backlog: flag to process all messages that were not read by this consumer group.
Expand All @@ -101,8 +100,8 @@ class RedisEventConsumer(EventBusConsumer):
consumer: consumer instance.
"""

def __init__(self, topic, group_id, consumer_name, signal=None, # pylint: disable=unused-argument
last_read_msg_id=None, check_backlog=False, claim_msgs_older_than=None):
def __init__(self, topic, group_id, consumer_name, last_read_msg_id=None,
check_backlog=False, claim_msgs_older_than=None):
self.topic = topic
self.group_id = group_id
self.consumer_name = consumer_name
Expand Down
3 changes: 2 additions & 1 deletion requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
-c constraints.txt

Django # Web application framework
openedx-events>=7.1.0 # consumer api and consume_events provided
# openedx-events 8.0.0 removes an argument from consumer initialization
openedx-events>=8.0.0 # Events API
edx_django_utils
edx_toggles

Expand Down
8 changes: 4 additions & 4 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ edx-opaque-keys[django]==2.3.0
# via openedx-events
edx-toggles==5.0.0
# via -r requirements/base.in
fastavro==1.7.3
fastavro==1.7.4
# via openedx-events
jinja2==3.1.2
# via code-annotations
markupsafe==2.1.2
# via jinja2
newrelic==8.8.0
# via edx-django-utils
openedx-events==7.1.0
openedx-events==8.0.0
# via -r requirements/base.in
pbr==5.11.1
# via stevedore
Expand All @@ -68,11 +68,11 @@ pytz==2023.3
# via django
pyyaml==6.0
# via code-annotations
redis==4.5.4
redis==4.5.5
# via walrus
sqlparse==0.4.4
# via django
stevedore==5.0.0
stevedore==5.1.0
# via
# code-annotations
# edx-django-utils
Expand Down
2 changes: 1 addition & 1 deletion requirements/ci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ filelock==3.12.0
# virtualenv
packaging==23.1
# via tox
platformdirs==3.5.0
platformdirs==3.5.1
# via virtualenv
pluggy==1.0.0
# via tox
Expand Down
18 changes: 9 additions & 9 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ asgiref==3.6.0
# via
# -r requirements/quality.txt
# django
astroid==2.15.4
astroid==2.15.5
# via
# -r requirements/quality.txt
# pylint
Expand Down Expand Up @@ -102,7 +102,7 @@ exceptiongroup==1.1.1
# via
# -r requirements/quality.txt
# pytest
fastavro==1.7.3
fastavro==1.7.4
# via
# -r requirements/quality.txt
# openedx-events
Expand Down Expand Up @@ -140,7 +140,7 @@ newrelic==8.8.0
# via
# -r requirements/quality.txt
# edx-django-utils
openedx-events==7.1.0
openedx-events==8.0.0
# via -r requirements/quality.txt
packaging==23.1
# via
Expand All @@ -158,7 +158,7 @@ pbr==5.11.1
# stevedore
pip-tools==6.13.0
# via -r requirements/pip-tools.txt
platformdirs==3.5.0
platformdirs==3.5.1
# via
# -r requirements/ci.txt
# -r requirements/quality.txt
Expand Down Expand Up @@ -191,7 +191,7 @@ pydocstyle==6.3.0
# via -r requirements/quality.txt
pygments==2.15.1
# via diff-cover
pylint==2.17.3
pylint==2.17.4
# via
# -r requirements/quality.txt
# edx-lint
Expand All @@ -206,7 +206,7 @@ pylint-django==2.5.3
# via
# -r requirements/quality.txt
# edx-lint
pylint-plugin-utils==0.7
pylint-plugin-utils==0.8.2
# via
# -r requirements/quality.txt
# pylint-celery
Expand Down Expand Up @@ -245,7 +245,7 @@ pyyaml==6.0
# -r requirements/quality.txt
# code-annotations
# edx-i18n-tools
redis==4.5.4
redis==4.5.5
# via
# -r requirements/quality.txt
# walrus
Expand All @@ -263,7 +263,7 @@ sqlparse==0.4.4
# via
# -r requirements/quality.txt
# django
stevedore==5.0.0
stevedore==5.1.0
# via
# -r requirements/quality.txt
# code-annotations
Expand Down Expand Up @@ -295,7 +295,7 @@ tox==3.28.0
# tox-battery
tox-battery==0.6.1
# via -r requirements/ci.txt
typing-extensions==4.5.0
typing-extensions==4.6.0
# via
# -r requirements/quality.txt
# astroid
Expand Down
16 changes: 8 additions & 8 deletions requirements/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ bleach==6.0.0
# via readme-renderer
build==0.10.0
# via -r requirements/doc.in
certifi==2022.12.7
certifi==2023.5.7
# via requests
cffi==1.15.1
# via
Expand Down Expand Up @@ -93,7 +93,7 @@ exceptiongroup==1.1.1
# via
# -r requirements/test.txt
# pytest
fastavro==1.7.3
fastavro==1.7.4
# via
# -r requirements/test.txt
# openedx-events
Expand Down Expand Up @@ -139,7 +139,7 @@ newrelic==8.8.0
# via
# -r requirements/test.txt
# edx-django-utils
openedx-events==7.1.0
openedx-events==8.0.0
# via -r requirements/test.txt
packaging==23.1
# via
Expand Down Expand Up @@ -209,11 +209,11 @@ pyyaml==6.0
# code-annotations
readme-renderer==37.3
# via twine
redis==4.5.4
redis==4.5.5
# via
# -r requirements/test.txt
# walrus
requests==2.29.0
requests==2.31.0
# via
# requests-toolbelt
# sphinx
Expand Down Expand Up @@ -256,7 +256,7 @@ sqlparse==0.4.4
# via
# -r requirements/test.txt
# django
stevedore==5.0.0
stevedore==5.1.0
# via
# -r requirements/test.txt
# code-annotations
Expand All @@ -275,11 +275,11 @@ tomli==2.0.1
# pytest
twine==4.0.2
# via -r requirements/doc.in
typing-extensions==4.5.0
typing-extensions==4.6.0
# via
# pydata-sphinx-theme
# rich
urllib3==1.26.15
urllib3==2.0.2
# via
# requests
# twine
Expand Down
2 changes: 1 addition & 1 deletion requirements/pip.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ wheel==0.40.0
# The following packages are considered to be unsafe in a requirements file:
pip==23.1.2
# via -r requirements/pip.in
setuptools==67.7.2
setuptools==67.8.0
# via -r requirements/pip.in
18 changes: 9 additions & 9 deletions requirements/quality.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ asgiref==3.6.0
# via
# -r requirements/test.txt
# django
astroid==2.15.4
astroid==2.15.5
# via
# pylint
# pylint-celery
Expand Down Expand Up @@ -80,7 +80,7 @@ exceptiongroup==1.1.1
# via
# -r requirements/test.txt
# pytest
fastavro==1.7.3
fastavro==1.7.4
# via
# -r requirements/test.txt
# openedx-events
Expand Down Expand Up @@ -108,7 +108,7 @@ newrelic==8.8.0
# via
# -r requirements/test.txt
# edx-django-utils
openedx-events==7.1.0
openedx-events==8.0.0
# via -r requirements/test.txt
packaging==23.1
# via
Expand All @@ -118,7 +118,7 @@ pbr==5.11.1
# via
# -r requirements/test.txt
# stevedore
platformdirs==3.5.0
platformdirs==3.5.1
# via pylint
pluggy==1.0.0
# via
Expand All @@ -136,7 +136,7 @@ pycparser==2.21
# cffi
pydocstyle==6.3.0
# via -r requirements/quality.in
pylint==2.17.3
pylint==2.17.4
# via
# edx-lint
# pylint-celery
Expand All @@ -146,7 +146,7 @@ pylint-celery==0.3
# via edx-lint
pylint-django==2.5.3
# via edx-lint
pylint-plugin-utils==0.7
pylint-plugin-utils==0.8.2
# via
# pylint-celery
# pylint-django
Expand Down Expand Up @@ -179,7 +179,7 @@ pyyaml==6.0
# via
# -r requirements/test.txt
# code-annotations
redis==4.5.4
redis==4.5.5
# via
# -r requirements/test.txt
# walrus
Expand All @@ -191,7 +191,7 @@ sqlparse==0.4.4
# via
# -r requirements/test.txt
# django
stevedore==5.0.0
stevedore==5.1.0
# via
# -r requirements/test.txt
# code-annotations
Expand All @@ -209,7 +209,7 @@ tomli==2.0.1
# pytest
tomlkit==0.11.8
# via pylint
typing-extensions==4.5.0
typing-extensions==4.6.0
# via
# astroid
# pylint
Expand Down
8 changes: 4 additions & 4 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ edx-toggles==5.0.0
# via -r requirements/base.txt
exceptiongroup==1.1.1
# via pytest
fastavro==1.7.3
fastavro==1.7.4
# via
# -r requirements/base.txt
# openedx-events
Expand All @@ -81,7 +81,7 @@ newrelic==8.8.0
# via
# -r requirements/base.txt
# edx-django-utils
openedx-events==7.1.0
openedx-events==8.0.0
# via -r requirements/base.txt
packaging==23.1
# via pytest
Expand Down Expand Up @@ -127,15 +127,15 @@ pyyaml==6.0
# via
# -r requirements/base.txt
# code-annotations
redis==4.5.4
redis==4.5.5
# via
# -r requirements/base.txt
# walrus
sqlparse==0.4.4
# via
# -r requirements/base.txt
# django
stevedore==5.0.0
stevedore==5.1.0
# via
# -r requirements/base.txt
# code-annotations
Expand Down

0 comments on commit 5a098f5

Please sign in to comment.