Skip to content

Remove Attributes interface #118

@bsideup

Description

@bsideup

In the current version of SDK, one has to deal with generic signature of CloudEvent and an unnecessary allocation of the AttributesImpl object.

While working on CloudEvents for Liiklus, I had to implement our own CloudEvent type that implements both CloudEvent and Attributes to reduce the allocations (see the link)

Since (according to the spec) there is always an 1:1 mapping of an event and its attributes, I suggest to remove the interface and make the fields part of the CloudEvent interface.

To make the change less impactful and support a migration path, I suggest we do it in two steps (that should be released separately):

  1. Make CloudEvent implementations implement both CloudEvent and Attributes and return this from getAttributes()
  2. Make CloudEvent extend from Attributes and turn getAttributes() into a default method that returns this and deprecate getAttributes() and Attributes
  3. Remove Attributes and ``getAttributes()and move the fields to theCloudEvent` interface

If the community agrees, I can work on all 3 PRs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions