Skip to content

make eventId an optional field #326

@jric

Description

@jric

In our organization eventId is an optional field. Therefore, we do not use the CloudEvent spec as defined. I would prefer to fix that impedance. I hope either I can convince cloudevent spec to change or someone here can convince me that we're doing it wrong.

Reasons to make it optional:

  1. DRY (don't repeat yourself) principle: There is usually some combination of fields in any event which can be used to identify a "unique" event. In our org, we are not interested in any event which could be confused with another but for the id. We always want to know: Where did the event originate, at what time, and what type of event was it. Combined, that information always uniquely defines an event, so we don't need another id. We just need the data and to know which fields hold that data. Then, if we want, we can always combine (e.g. hash) that data later to create a unique composite key.
  2. KISS (keep it stupid simple): One of our principles is to keep things as simple as possible, especially at the interface. No eventId means fewer fields for consumers to manage, and fewer fields for producers to create or worry about generating correctly.
  3. Single source of truth: If there is both an eventId and another unique key, what if those two don't agree? On the plus side, the id can serve as a "checksum" of sorts. However, generating the eventId has to be done correctly. It must represent the producer's "idea" of what constitutes a unique event, and there is no documentation of that logic, because it's hidden in the algorithm that chooses when to mint a new id, rather than being explicit in the data. For instance, it would probably be a bug if each communication retry generated a new "eventId", or if two events were generated with the same id, but different payloads, e.g. in a multi-threaded race condition.

Reasons to keep it required:

I'm not sure what to say here. I think there are a class of tools that will be able to operate much more simply once there is a single field that represents the event. However, I think those tools could simply require the id at that point, rather than requiring every event to have the same eventId throughout its lifecycle. In case of an event pipeline where an event forks into multiple events, this id cannot stay static anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions