Skip to content

pubsub: Remove cloudevents dependency#707

Open
nuclearcat wants to merge 1 commit into
kernelci:mainfrom
nuclearcat:remove-cloudevents
Open

pubsub: Remove cloudevents dependency#707
nuclearcat wants to merge 1 commit into
kernelci:mainfrom
nuclearcat:remove-cloudevents

Conversation

@nuclearcat

Copy link
Copy Markdown
Member

The pinned cloudevents 2.0.0 no longer provides the cloudevents.http module, so api/pubsub.py and api/pubsub_mongo.py fail to import and the API cannot start. Instead of migrating to the new cloudevents v2 API, drop the library: it was only used to fill in the "id", "time" and "specversion" attributes and serialize the event to JSON.

Add a small to_cloudevent_json() helper that emits the exact same CloudEvents 1.0 JSON envelope (verified byte-identical against cloudevents 1.12.1 output for dict data, string data and extension attributes such as "owner"), so the wire format consumed by external subscribers is unchanged.

The pinned cloudevents 2.0.0 no longer provides the cloudevents.http
module, so api/pubsub.py and api/pubsub_mongo.py fail to import and
the API cannot start. Instead of migrating to the new cloudevents v2
API, drop the library: it was only used to fill in the "id", "time"
and "specversion" attributes and serialize the event to JSON.

Add a small to_cloudevent_json() helper that emits the exact same
CloudEvents 1.0 JSON envelope (verified byte-identical against
cloudevents 1.12.1 output for dict data, string data and extension
attributes such as "owner"), so the wire format consumed by external
subscribers is unchanged.

Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
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.

1 participant