use of org.apache.pulsar.common.naming.TopicName in project incubator-pulsar by apache.
the class PersistentTopicsImpl method unloadAsync.
@Override
public CompletableFuture<Void> unloadAsync(String topic) {
TopicName tn = validateTopic(topic);
WebTarget path = topicPath(tn, "unload");
return asyncPutRequest(path, Entity.entity("", MediaType.APPLICATION_JSON));
}
use of org.apache.pulsar.common.naming.TopicName in project incubator-pulsar by apache.
the class PersistentTopicsImpl method deleteSubscriptionAsync.
@Override
public CompletableFuture<Void> deleteSubscriptionAsync(String topic, String subName) {
TopicName tn = validateTopic(topic);
String encodedSubName = Codec.encode(subName);
WebTarget path = topicPath(tn, "subscription", encodedSubName);
return asyncDeleteRequest(path);
}
use of org.apache.pulsar.common.naming.TopicName in project incubator-pulsar by apache.
the class PersistentTopicsImpl method getInternalStatsAsync.
@Override
public CompletableFuture<PersistentTopicInternalStats> getInternalStatsAsync(String topic) {
TopicName tn = validateTopic(topic);
WebTarget path = topicPath(tn, "internalStats");
final CompletableFuture<PersistentTopicInternalStats> future = new CompletableFuture<>();
asyncGetRequest(path, new InvocationCallback<PersistentTopicInternalStats>() {
@Override
public void completed(PersistentTopicInternalStats response) {
future.complete(response);
}
@Override
public void failed(Throwable throwable) {
future.completeExceptionally(getApiException(throwable.getCause()));
}
});
return future;
}
use of org.apache.pulsar.common.naming.TopicName in project incubator-pulsar by apache.
the class PersistentTopicsImpl method revokePermissions.
@Override
public void revokePermissions(String topic, String role) throws PulsarAdminException {
try {
TopicName tn = TopicName.get(topic);
WebTarget path = topicPath(tn, "permissions", role);
request(path).delete(ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
}
}
use of org.apache.pulsar.common.naming.TopicName in project incubator-pulsar by apache.
the class PersistentTopicsImpl method expireMessagesAsync.
@Override
public CompletableFuture<Void> expireMessagesAsync(String topic, String subName, long expireTimeInSeconds) {
TopicName tn = validateTopic(topic);
String encodedSubName = Codec.encode(subName);
WebTarget path = topicPath(tn, "subscription", encodedSubName, "expireMessages", String.valueOf(expireTimeInSeconds));
return asyncPostRequest(path, Entity.entity("", MediaType.APPLICATION_JSON));
}
Aggregations