Skip to content

Allow setting keys in outbox messages #1

Closed
@mgibowski

Description

@mgibowski

The problem

At the moment, published messages have always an empty key:

case :brod.produce_sync(client_id, topic, partition, "", values) do

This prevents key-based retention via topic compaction:
https://developer.confluent.io/courses/architecture/compaction/#topic-compaction-key-based-retention

The solution

That would be a breaking change, but I think the MyApp.Outbox.publish/2 function should accept three arguments and become:

MyApp.Outbox.publish("topic", "key", %{hello: :kafka})

Similarly, the Kafkaesque.publish/4 function would become Kafkaesque.publish/5 and accept key argument just before the payload.

And the structure of Kafkaesque.Message schema would be extended with the key field.


@v0idpwn What do you think?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions