Managing Namespaces
Pulsar namespaces are logical groupings of topics.
Namespaces can be managed via:
- The
namespaces
command of thepulsar-admin
tool - The
/admin/v2/namespaces
endpoint of the admin REST API - The
namespaces
method of the PulsarAdmin object in the Java API
Namespaces resources​
Create​
You can create new namespaces under a given tenant.
pulsar-admin​
Use the create
subcommand and specify the namespace by name:
$ pulsar-admin namespaces create test-tenant/test-namespace
REST API​
PUT /admin/v2/namespaces/:tenant/:namespace/createNamespace
Java​
admin.namespaces().createNamespace(namespace);
Get policies​
You can fetch the current policies associated with a namespace at any time.
pulsar-admin​
Use the policies
subcommand and specify the namespace:
$ pulsar-admin namespaces policies test-tenant/test-namespace
{
"auth_policies": {
"namespace_auth": {},
"destination_auth": {}
},
"replication_clusters": [],
"bundles_activated": true,
"bundles": {
"boundaries": [
"0x00000000",
"0xffffffff"
],
"numBundles": 1
},
"backlog_quota_map": {},
"persistence": null,
"latency_stats_sample_rate": {},
"message_ttl_in_seconds": 0,
"retention_policies": null,
"deleted": false
}
REST API​
GET /admin/v2/namespaces/:tenant/:namespace/getPolicies
Java​
admin.namespaces().getPolicies(namespace);
List namespaces within a tenant​
You can list all namespaces within a given Pulsar tenant.