julie icon indicating copy to clipboard operation
julie copied to clipboard

Naming topics by its metadata

Open escobarana opened this issue 3 years ago • 1 comments

In my topology file I add 'metadata' to my elements (topics, consumers, producers, streams, connectors) and I've been trying to name them by their metadata but it is not possible.

Example: I have the following topology for a topic - (...) topics: - name: "anyName" config: replication.factor: "3" num.partitions: "6" cleanup.policy: "delete" metadata: type: "x1" domain: "x2" subdomain: "x3" name: "theName" (...)

I would like to create the topic with the name: "x1-x2-x3-theName"

I modified topology.topic.prefix.format={{ topic }} topology.project.prefix.format= topology.topic.prefix.separator=-

Doing this I get the topic name as "anyName"

It would be perfect if I could do the following: topology.topic.prefix.format={{ topic.metadata }} topology.project.prefix.format= topology.topic.prefix.separator=-

And get the desired name : "x1-x2-x3-theName"

escobarana avatar Nov 10 '21 11:11 escobarana

@escobarana For the topic naming, have a look at this: https://julieops.readthedocs.io/en/latest/the-descriptor-files.html#getting-started

In between the context and the project attribute the user can define a free list of attributes in form of a key and value. This list of attributes is going to be listed, in order, by default during the topic name composition in between the context and the project attribute.

You could have a descriptor file like this:

---
context: x1
domain: x2
subdomain: x3
projects: 
  - name: projectName
    topics:
      - name: topicName
        schemas:
          value.schema.file: "./schemas/example.avsc"
          value.record.type: "Example"
        config:
          replication.factor: 3
          num.partitions: 1

which would result in a topic name `x1.x2.x3.projectName.topicName

shan916 avatar Jan 04 '22 20:01 shan916