Skip to content

Commit

Permalink
fix: use new method for setting client id (#225)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rebecca Graber authored Jan 25, 2024
1 parent f2969b1 commit e8df078
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 16 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ Change Log
Unreleased
**********

[5.6.0] - 2024-01-24
[5.6.0] - 2024-01-25
********************
Changed
=======
* Added configurable client.id to base configuration
* Added client.id to base configuration.

[5.5.0] - 2023-09-21
********************
Expand Down
7 changes: 2 additions & 5 deletions edx_event_bus_kafka/internal/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from django.conf import settings
from django.dispatch import receiver
from django.test.signals import setting_changed
from openedx_events.data import get_service_name

# See https://github.com/openedx/event-bus-kafka/blob/main/docs/decisions/0005-optional-import-of-confluent-kafka.rst
try:
Expand Down Expand Up @@ -109,11 +110,7 @@ def load_common_settings() -> Optional[dict]:
'sasl.password': secret,
})

# .. setting_name: EVENT_BUS_KAFKA_CLIENT_ID
# .. setting_default: None
# .. setting_description: Identifier for the producing/consuming application. Useful for debugging. If not set
# .. Kafka will use 'rdkafka' as the identifier
client_id = getattr(settings, 'EVENT_BUS_APP_NAME', None)
client_id = get_service_name()
if client_id:
base_settings.update({
'client.id': client_id
Expand Down
4 changes: 2 additions & 2 deletions edx_event_bus_kafka/internal/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ def test_full(self):
EVENT_BUS_KAFKA_BOOTSTRAP_SERVERS='localhost:54321',
EVENT_BUS_KAFKA_API_KEY='some_other_key',
EVENT_BUS_KAFKA_API_SECRET='some_other_secret',
EVENT_BUS_APP_NAME='my_client_id',
EVENTS_SERVICE_NAME='my_service',
):
assert config.load_common_settings() == {
'bootstrap.servers': 'localhost:54321',
'sasl.mechanism': 'PLAIN',
'security.protocol': 'SASL_SSL',
'sasl.username': 'some_other_key',
'sasl.password': 'some_other_secret',
'client.id': 'my_client_id',
'client.id': 'my_service',
}


Expand Down
4 changes: 2 additions & 2 deletions requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
-c constraints.txt

Django # Web application framework
# openedx-events 8.5.0 adds serialization methods to EventsMetadata
openedx-events>=8.5.0 # Events API
# openedx-events 9.3.0 adds get_service_name method
openedx-events>=9.3.0 # Events API
edx_django_utils
edx_toggles
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ markupsafe==2.1.4
# via jinja2
newrelic==9.5.0
# via edx-django-utils
openedx-events==9.2.0
openedx-events==9.3.0
# via -r requirements/base.in
pbr==6.0.0
# via stevedore
Expand Down
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ nh3==0.2.15
# via
# -r requirements/quality.txt
# readme-renderer
openedx-events==9.2.0
openedx-events==9.3.0
# via -r requirements/quality.txt
packaging==23.2
# via
Expand Down
2 changes: 1 addition & 1 deletion requirements/doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ newrelic==9.5.0
# edx-django-utils
nh3==0.2.15
# via readme-renderer
openedx-events==9.2.0
openedx-events==9.3.0
# via -r requirements/test.txt
packaging==23.2
# via
Expand Down
2 changes: 1 addition & 1 deletion requirements/quality.txt
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ newrelic==9.5.0
# edx-django-utils
nh3==0.2.15
# via readme-renderer
openedx-events==9.2.0
openedx-events==9.3.0
# via -r requirements/test.txt
packaging==23.2
# via
Expand Down
2 changes: 1 addition & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ newrelic==9.5.0
# via
# -r requirements/base.txt
# edx-django-utils
openedx-events==9.2.0
openedx-events==9.3.0
# via -r requirements/base.txt
packaging==23.2
# via pytest
Expand Down

0 comments on commit e8df078

Please sign in to comment.