Skip to content

Commit

Permalink
docs: update adding events how-to to use new config style (#414)
Browse files Browse the repository at this point in the history
  • Loading branch information
navinkarkera authored Nov 4, 2024
1 parent 07550c5 commit b5b7d68
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions docs/how-tos/adding-events-to-event-bus.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,22 @@ In the producing/host application, include ``openedx_events`` in ``INSTALLED_APP
# .. setting_name: EVENT_BUS_PRODUCER_CONFIG
# .. setting_default: {}
# .. setting_description: Dictionary of event_types mapped to lists of dictionaries containing topic related configuration.
# Each topic configuration dictionary contains
# * a topic/stream name called `topic` where the event will be pushed to.
# * a flag called `enabled` denoting whether the event will be published to the topic.
# * `event_key_field` which is a period-delimited string path to event data field to use as event key.
# .. setting_description: Dictionary of event_types to dictionaries for topic-related configuration.
# Each topic configuration dictionary uses the topic as a key and contains:
# * A flag called `enabled` denoting whether the event will be published.
# * The `event_key_field` which is a period-delimited string path to event data field to use as event key.
# Note: The topic names should not include environment prefix as it will be dynamically added based on
# EVENT_BUS_TOPIC_PREFIX setting.
EVENT_BUS_PRODUCER_CONFIG = {
'org.openedx.content_authoring.xblock.published.v1': [
{'topic': 'content-authoring-xblock-lifecycle', 'event_key_field': 'xblock_info.usage_key', 'enabled': True},
{'topic': 'content-authoring-xblock-published', 'event_key_field': 'xblock_info.usage_key', 'enabled': True},
],
'org.openedx.content_authoring.xblock.deleted.v1': [
{'topic': 'content-authoring-xblock-lifecycle', 'event_key_field': 'xblock_info.usage_key', 'enabled': True},
],
'org.openedx.content_authoring.xblock.published.v1': {
'content-authoring-xblock-lifecycle': {'event_key_field': 'xblock_info.usage_key', 'enabled': True},
'content-authoring-xblock-published': {'event_key_field': 'xblock_info.usage_key', 'enabled': True}
},
'org.openedx.content_authoring.xblock.deleted.v1': {
'content-authoring-xblock-lifecycle': {'event_key_field': 'xblock_info.usage_key', 'enabled': True},
},
}
The ``EVENT_BUS_PRODUCER_CONFIG`` is read by openedx_events and a handler is attached which does the leg work of reading the configuration again and pushing to appropriate handlers.
The ``EVENT_BUS_PRODUCER_CONFIG`` is read by openedx_events and a handler is
attached which does the leg work of reading the configuration again and pushing
to appropriate handlers.

0 comments on commit b5b7d68

Please sign in to comment.