Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: emit original headers with message #122

Merged
merged 11 commits into from
Feb 2, 2023

Conversation

rgraber
Copy link
Contributor

@rgraber rgraber commented Jan 31, 2023

Issue: openedx/openedx-events#162

Pass all EventsMetadata fields as headers when producing an event to Kafka. The consumer takes these headers and emits the signal with the original metadata, as reconstructed from the message headers.

To prevent the need for lock-step upgrades, all headers except event type and id are considered optional. If not passed, we will just use the default value in EventsMetadata. This is why _get_metadata_from_headers returns and EventsMetadata object instead of just a dictionary of kwargs to pass to send_event_with_custom_metadata.
We can make another ticket to make the other headers mandatory after and possibly rethink what _get_metadata_from_headers returns.

Merge checklist:
Check off if complete or not applicable:

  • Version bumped
  • Changelog record added
  • Documentation updated (not only docstrings)
  • Commits are squashed
  • Noted any: Concerns, dependencies, deadlines, tickets, testing instructions

@rgraber rgraber marked this pull request as draft January 31, 2023 14:13
@rgraber rgraber force-pushed the rsgraber/20230126-pass-real-time-along branch from 4c13fc1 to 6d806b0 Compare January 31, 2023 14:33
@rgraber rgraber force-pushed the rsgraber/20230126-pass-real-time-along branch from d148a01 to 1ed35c4 Compare January 31, 2023 20:40
@rgraber rgraber marked this pull request as ready for review February 1, 2023 14:55
@rgraber rgraber changed the title Rsgraber/20230126 pass real time along feat: emit original headers with message Feb 1, 2023
requirements/base.in Outdated Show resolved Hide resolved
Copy link
Contributor

@timmc-edx timmc-edx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few small things, but looks good overall!

edx_event_bus_kafka/internal/utils.py Outdated Show resolved Hide resolved
edx_event_bus_kafka/internal/utils.py Outdated Show resolved Hide resolved
edx_event_bus_kafka/internal/utils.py Outdated Show resolved Hide resolved
edx_event_bus_kafka/internal/utils.py Outdated Show resolved Hide resolved
edx_event_bus_kafka/internal/tests/test_consumer.py Outdated Show resolved Hide resolved
@rgraber rgraber merged commit 51b0055 into main Feb 2, 2023
@rgraber rgraber deleted the rsgraber/20230126-pass-real-time-along branch February 2, 2023 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants