CLI: Resources
This page covers the resource management commands for namespaces, topics, and schemas. For cluster and broker operations, see CLI: Cluster & Brokers.
Namespaces
Section titled “Namespaces”Namespaces provide logical isolation for topics. Use them to organize by application, team, or environment.
List Topics in Namespace
Section titled “List Topics in Namespace”danube-admin namespaces topics <NAMESPACE>Topics in namespace 'default': /default/user-events /default/payment-logs /default/analyticsView Policies
Section titled “View Policies”danube-admin namespaces policies <NAMESPACE>{ "max_topics_per_namespace": 1000, "max_producers_per_topic": 100, "max_consumers_per_topic": 100, "message_ttl_seconds": 604800, "retention_policy": "time_based"}| Policy | Description | Typical Values |
|---|---|---|
max_topics_per_namespace | Maximum number of topics | 100 – 10000 |
max_producers_per_topic | Maximum producers per topic | 10 – 1000 |
max_consumers_per_topic | Maximum consumers per topic | 10 – 1000 |
message_ttl_seconds | Message time-to-live | 3600 (1h) – 604800 (7d) |
retention_policy | How messages are retained | time_based, size_based |
Create Namespace
Section titled “Create Namespace”danube-admin namespaces create productionNaming conventions: use lowercase letters and hyphens. Keep names descriptive — production, staging, team-analytics, payment-service.
Delete Namespace
Section titled “Delete Namespace”danube-admin namespaces delete old-namespace# 1. List topics before deletiondanube-admin namespaces topics my-namespace
# 2. Check policies to understand impactdanube-admin namespaces policies my-namespace
# 3. Only then deletedanube-admin namespaces delete my-namespaceMulti-Environment Setup
Section titled “Multi-Environment Setup”# Create environmentsdanube-admin namespaces create productiondanube-admin namespaces create stagingdanube-admin namespaces create development
# Create same topics in eachfor env in production staging development; do danube-admin topics create /$env/user-events danube-admin topics create /$env/order-eventsdoneTopics
Section titled “Topics”Topics are the fundamental messaging primitive in Danube — named channels for publishing and consuming messages.
List Topics
Section titled “List Topics”danube-admin topics list --namespace defaultdanube-admin topics list --broker broker-001danube-admin topics list --namespace default --output jsonCreate Topic
Section titled “Create Topic”# Simple topic (non-reliable delivery)danube-admin topics create /default/logs
# With reliable deliverydanube-admin topics create /default/events --dispatch-strategy reliable
# Partitioned with schemadanube-admin topics create /default/orders \ --partitions 5 \ --schema-subject order-events \ --dispatch-strategy reliable
# Using namespace flag instead of path prefixdanube-admin topics create my-topic --namespace default| Option | Description | Default |
|---|---|---|
--namespace | Namespace (if not in topic path) | — |
--partitions | Number of partitions | 1 |
--schema-subject | Schema subject from registry | None |
--dispatch-strategy | reliable or non_reliable | non_reliable |
Dispatch strategies:
| Strategy | Delivery | Use Case |
|---|---|---|
non_reliable | At-most-once (fire-and-forget) | Logs, metrics, non-critical events |
reliable | At-least-once (with acknowledgments) | Transactions, orders, critical events |
Describe Topic
Section titled “Describe Topic”View detailed information about a topic including schema and subscriptions.
danube-admin topics describe /default/user-eventsTopic: /default/user-eventsBroker ID: broker-001Delivery: Reliable
📋 Schema Registry: Subject: user-events Schema ID: 12345 Version: 2 Type: json_schema Compatibility: BACKWARD
Subscriptions: ["analytics-consumer", "audit-logger"]{ "topic": "/default/user-events", "broker_id": "broker-001", "delivery": "Reliable", "schema_subject": "user-events", "schema_id": 12345, "schema_version": 2, "schema_type": "json_schema", "compatibility_mode": "BACKWARD", "subscriptions": ["analytics-consumer", "audit-logger"]}List Subscriptions
Section titled “List Subscriptions”danube-admin topics subscriptions /default/ordersDelete Topic
Section titled “Delete Topic”danube-admin topics delete /default/old-topic# 1. Check active subscriptionsdanube-admin topics subscriptions /default/my-topic
# 2. Verify topic detailsdanube-admin topics describe /default/my-topic
# 3. Deletedanube-admin topics delete /default/my-topicUnsubscribe
Section titled “Unsubscribe”Remove a specific subscription from a topic, disconnecting consumers using it.
danube-admin topics unsubscribe /default/events --subscription old-consumerUnload Topic
Section titled “Unload Topic”Gracefully unload a topic from its current broker for reassignment.
danube-admin topics unload /default/eventsDispatch Configuration
Section titled “Dispatch Configuration”Override the cluster-wide max_unacked_messages for a specific subscription. This controls how many messages the broker pipelines to consumers before waiting for acknowledgments.
danube-admin topics set-dispatch-config /default/orders \ --subscription order-workers \ --max-unacked-messages 50danube-admin topics get-dispatch-config /default/orders \ --subscription order-workers| Option | Required | Description |
|---|---|---|
--subscription | Yes | Subscription name |
--max-unacked-messages | Yes (set) | Pipelining depth (1–10,000) |
Per-subscription overrides are persisted in the metadata store and take effect on the next consumer reconnect. If no override is set, the cluster-wide default from dispatch.max_unacked_messages in danube_broker.yml is used. See Broker Configuration for the config reference.
Schema Configuration (Admin-Only)
Section titled “Schema Configuration (Admin-Only)”These commands let administrators control topic-level schema enforcement independently of what producers set.
Configure Topic Schema
Section titled “Configure Topic Schema”Associate a schema subject with a topic and set the validation policy.
danube-admin topics configure-schema /production/orders \ --subject order-events \ --validation-policy enforce \ --enable-payload-validation| Option | Required | Values | Description |
|---|---|---|---|
--subject | Yes | String | Schema subject from registry |
--validation-policy | No | none, warn, enforce | Validation strictness (default: none) |
--enable-payload-validation | No | Flag | Enable deep payload validation |
Set Validation Policy
Section titled “Set Validation Policy”Update the validation policy without changing the schema subject.
# Switch to warn mode for debuggingdanube-admin topics set-validation-policy /production/orders \ --policy warn --enable-payload-validation
# Re-enable strict validationdanube-admin topics set-validation-policy /production/orders \ --policy enforce --enable-payload-validation
# Disable validation temporarilydanube-admin topics set-validation-policy /production/orders \ --policy none| Policy | Behavior | Use Case |
|---|---|---|
none | No validation | Development, unstructured data |
warn | Validate and log errors, accept messages | Monitoring, gradual rollout |
enforce | Reject invalid messages | Production data quality |
Get Schema Configuration
Section titled “Get Schema Configuration”danube-admin topics get-schema-config /production/ordersTopic: /production/ordersSchema Subject: order-eventsValidation Policy: ENFORCEPayload Validation: ENABLEDCached Schema ID: 12345Topic with Schema: Full Workflow
Section titled “Topic with Schema: Full Workflow”# 1. Register schemadanube-admin schemas register order-events \ --schema-type json_schema \ --file schemas/orders.json \ --description "Order transaction schema"
# 2. Set compatibility modedanube-admin schemas set-compatibility order-events --mode backward
# 3. Create topicdanube-admin topics create /production/orders \ --dispatch-strategy reliable --partitions 5
# 4. Configure schema with strict validationdanube-admin topics configure-schema /production/orders \ --subject order-events \ --validation-policy enforce \ --enable-payload-validation
# 5. Verifydanube-admin topics describe /production/ordersdanube-admin topics get-schema-config /production/ordersSchemas
Section titled “Schemas”Manage the Schema Registry: register schemas, track versions, check compatibility, and control evolution policies.
Register
Section titled “Register”danube-admin schemas register user-events \ --schema-type json_schema \ --file schemas/user-events.json \ --description "User event schema" \ --tags users analytics✅ Registered new schema versionSubject: user-eventsSchema ID: 12345Version: 1Fingerprint: sha256:abc123...| Type | Description | Extension |
|---|---|---|
json_schema | JSON Schema (Draft 7) | .json |
avro | Apache Avro | .avsc |
protobuf | Protocol Buffers | .proto |
string | Plain text, no validation | .txt |
bytes | Raw bytes, no validation | — |
Get Schema
Section titled “Get Schema”# By subject (latest version)danube-admin schemas get --subject user-events
# By schema IDdanube-admin schemas get --id 12345
# JSON outputdanube-admin schemas get --subject user-events --output jsonSchema ID: 12345Version: 2Subject: user-eventsType: json_schemaCompatibility Mode: BACKWARDDescription: User registration and login eventsTags: users, authentication, analyticsList Versions
Section titled “List Versions”danube-admin schemas versions user-eventsVersions for subject 'user-events': Version 1: schema_id=12344, fingerprint=sha256:old123... Created by: alice Description: Initial schema Version 2: schema_id=12345, fingerprint=sha256:abc123... Created by: bob Description: Added email fieldCheck Compatibility
Section titled “Check Compatibility”Validate if a new schema is compatible with existing versions before registering.
danube-admin schemas check user-events \ --file schemas/user-events-v2.json \ --schema-type json_schema✅ Schema is compatible with subject 'user-events'❌ Schema is NOT compatible with subject 'user-events'
Compatibility errors: - Field 'user_id' was removed (breaking change) - Field 'email' is now required (breaking change for existing consumers)Compatibility Mode
Section titled “Compatibility Mode”danube-admin schemas get-compatibility user-eventsdanube-admin schemas set-compatibility user-events --mode backward| Mode | Description | Allows |
|---|---|---|
none | No checks | Any changes |
backward | New schema reads old data (default) | Add optional fields, remove fields |
forward | Old schema reads new data | Remove optional fields, add fields |
full | Both backward and forward | Add/remove optional fields only |
Delete Version
Section titled “Delete Version”danube-admin schemas delete user-events --version 1 --confirmSchema Evolution Workflow
Section titled “Schema Evolution Workflow”# 1. Check current schema and compatibility modedanube-admin schemas get --subject user-eventsdanube-admin schemas get-compatibility user-events
# 2. Check compatibility of new versiondanube-admin schemas check user-events \ --file schemas/user-events-v2.json \ --schema-type json_schema
# 3. Register if compatibledanube-admin schemas register user-events \ --schema-type json_schema \ --file schemas/user-events-v2.json \ --description "Added email field"
# 4. Verifydanube-admin schemas versions user-eventsSecurity
Section titled “Security”Security CLI commands (tokens, roles, bindings) are documented in the Securing a Cluster guide. See also:
- Authentication (JWT): token creation and validation details
- Authorization (RBAC): roles, permissions, and binding model