Skip to main content

Namespaces : Given namespace / Given namespaces

A namespace is a prefix that KTestify prepends to every topic name to form the physical Kafka topic name: namespace.topicName. This lets you share a single Kafka cluster across environments by varying the prefix.


Given namespace (single)โ€‹

Declares one namespace used by all topics in the scenario.

Given namespace
| namespace |
| myapp |
ColumnTypeRequiredDescription
namespacestringโœ…The namespace prefix (e.g. myapp, com.example)

Given namespaces (multiple)โ€‹

Declares multiple named namespaces when a scenario involves topics from more than one logical domain.

Given namespaces
| namespace | namespaceAlias |
| myapp.input | input-ns |
| myapp.audit | audit-ns |
ColumnTypeRequiredDescription
namespacestringโœ…The namespace prefix
namespaceAliasstringโœ…Alias used when assigning this namespace to a topic

Namespaces are then referenced in topic declarations:

Given output topic
| topicName | topicAlias | namespace | namespaceAlias |
| orders-out | orders | myapp.audit | audit-ns |

How namespacing worksโ€‹

Given namespace = myapp and topicName = orders-out, the physical Kafka topic used is:

myapp.orders-out

If no namespace is declared, the default from ktestify.kafka.topic-namespace in application.conf is used. If that is also empty, the topic name is used as-is.