Expand description
Apache Pulsar admin REST client (/admin/v2/...).
Thin async wrapper around reqwest for the broker’s JAX-RS admin API.
TLS is via rustls-tls. There are no channels and no background tasks: every
call is a one-shot await that resolves to a Result.
Endpoint paths mirror the broker. Each method’s rustdoc cites the Java
endpoint class (file + relevant @Path annotation) in apache/pulsar so a
reader can confirm the URL and HTTP verb against upstream.
§Quick start
use magnetar_admin::{AdminClient, TenantInfo};
let admin = AdminClient::builder()
.service_url("http://localhost:8080".parse()?)
.build()?;
let tenants = admin.tenants_list().await?;
println!("{tenants:?}");
admin
.tenant_create(
"acme",
TenantInfo {
admin_roles: vec!["admin".into()],
allowed_clusters: vec!["standalone".into()],
},
)
.await?;Structs§
- Admin
Client - Apache Pulsar admin REST client.
- Admin
Client Builder - Builder for
AdminClient. - Backlog
Quota - Java
BacklogQuota— one entry in the namespace-level backlog quota map.policyis a string (producer_request_hold,producer_exception,consumer_backlog_eviction) rather than a closed Rust enum so new broker enum values forward-decode cleanly. - Bookie
Info - Java
BookieInfo— a single bookie’s rack assignment, as stored in theracks-infometadata path and shipped onAdminClient::bookies_set_rack. Field names are camelCase on the wire (matchingorg.apache.pulsar.common.policies.data.BookieInfo, which carries onlyrackandhostname). - Delayed
Delivery Policies - Java
DelayedDeliveryPolicies— namespace-level switch + index-tick granularity for the broker’s delayed-message delivery tracker. Maps toorg.apache.pulsar.common.policies.data.DelayedDeliveryPolicies.tick_timecontrols how often the broker’s delay-index buckets are re-evaluated; smaller values give tighter delivery accuracy at a higher tracker cost. - Dispatch
Rate - Java
DispatchRate— a sliding-window throttle (msg/sec + byte/sec over aratePeriodInSecondwindow). Shared shape between the per-namespace consumer dispatch rate, the per-subscription dispatch rate, and the cross-cluster replicator dispatch rate. - Function
Config - Pulsar Functions configuration — the subset of Java’s
org.apache.pulsar.common.functions.FunctionConfigthat the URL-basedregister/updatecalls actually require. The Java type carries ~30 fields (process / k8s runtime tuning, secrets, deadletter topics, …); we expose the load-bearing ones an operator running a pre-compiled JAR needs. Unknown fields on the wire are tolerated by the broker, so adding extra knobs is an additive change later. - Long
Running Process Status - Java
LongRunningProcessStatus— the polling shape for triggered background jobs (compaction, offload). The broker returns one of fourstatusvalues:NOT_RUN(never triggered),RUNNING,SUCCESS,ERROR.last_erroris populated only onERROR. - Package
Metadata - Java
PackageMetadata— the metadata envelope Pulsar Packages attaches to each(type, tenant, namespace, name, version)tuple. Mirrorsorg.apache.pulsar.packages.management.core.common.PackageMetadata(Jackson camelCase on the wire).modification_timeis a broker-side timestamp in milliseconds-since-epoch — the broker emits it onGETand ignores caller-supplied values onPUT(overwriting them with the receive timestamp). - Persistence
Policies - Java
PersistencePolicies— namespace-levelBookKeeperlayout + managed-ledger write-shaping knobs. Maps to the broker’sorg.apache.pulsar.common.policies.data.PersistencePolicies. - Post
Schema Payload - Java
PostSchemaPayload— the request body forAdminClient::schema_postandAdminClient::schema_compatibility_check. The Java DTO has (type,schema,properties); both keys travel as-is on the wire.schemais the canonical-form blob for AVRO / JSON / PROTOBUF and the protobuf descriptor forPROTOBUF_NATIVE. - Publish
Rate - Java
PublishRate— producer-side throttle (msg/sec + byte/sec).-1on either dimension disables that axis of the throttle. Missing fields default to-1(not0) — same sentinel semantics asDispatchRate. UnlikeDispatchRate, there is no rate-period field; the broker uses a fixed 1-second window. - Retention
Policies - Java
RetentionPolicies— namespace-level retention policy.-1for either dimension means infinite. The broker applies whichever quota becomes binding first (time OR size). - Sink
Config - Java
SinkConfig— declarative description of a Pulsar IO Sink. Mirrorsorg.apache.pulsar.common.io.SinkConfig(Jackson camelCase on the wire). Theinputsslot is the list of source topics the sink reads from — the broker accepts either fully-qualified topic names ortenant/namespace/topicshorthand. Per-connector knobs ride inconfigsfor the same forward-compat reason asSourceConfig. - Source
Config - Java
SourceConfig— declarative description of a Pulsar IO Source. Mirrorsorg.apache.pulsar.common.io.SourceConfig(Jackson camelCase on the wire). Only the fields the JAX-RScreate/updatepaths require are typed; per-connector knobs ride along in the open-endedconfigsmap so a forward broker can add fields without a magnetar release. - Tenant
Info - Tenant policy info — admin roles and allowed clusters.
- Topic
Stats - Topic stats. Intentionally permissive: the Java
PersistentTopicStatsImplshape is large and shifts between releases; we extract the high-signal rates, throughput, sizes, and counters and pass the rest through as raw JSON.
Enums§
- Admin
Auth - Authentication strategy used by the admin client.
- Admin
Error - Errors returned by the admin client.
- Backlog
Quota Type - Java
BacklogQuotaType— selects which dimension aBacklogQuotaentry limits. - Package
Type - Pulsar Packages namespace dimension — the
{type}segment of the/admin/v3/packages/{type}/...URL. Maps to upstream’sPackageTypeenum (pulsar-packages-management/pulsar-packages-management-core/.../ PackageType.java): the broker only accepts the three lowercase tokensfunction,source,sinkand rejects everything else with 400. Modelled as a closed Rust enum so the URL builder cannot emit a value the broker will refuse.
Constants§
- DEFAULT_
TIMEOUT - Default request timeout. Mirrors
PulsarAdminBuilderJava default of 60s (seepulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/internal/ PulsarAdminBuilderImpl.java). - PACKAGE_
REGISTER_ TIMEOUT - Longer per-call timeout for
*_create_with_url/*_update_with_urlendpoints. The broker fetches the package from the supplied URL before responding, so the round-trip can comfortably exceed 60 s against a slow internal registry (S3 / GCS / function://) or a large.nar/.jarartifact. Overrides the client-level timeout for those calls only — every other admin verb keeps the 60 s budgetDEFAULT_TIMEOUTprovides.
Functions§
- split_
function_ id - Split a
tenant/namespace/nameFunctions / IO identifier into its three segments. Pulsar Functions never carry apersistent://scheme prefix (functions are not topics), so the parser is stricter than the internalsplit_topic(rustdoc cannot resolve the bare identifier becausesplit_topicis module-private). - split_
namespace - Split a
tenant/namespacestring into its two segments.