use of org.apache.pulsar.client.admin.PulsarAdminException in project incubator-pulsar by apache.
the class NamespacesImpl method getDispatchRate.
@Override
public DispatchRate getDispatchRate(String namespace) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
WebTarget path = namespacePath(ns, "dispatchRate");
return request(path).get(DispatchRate.class);
} catch (Exception e) {
throw getApiException(e);
}
}
use of org.apache.pulsar.client.admin.PulsarAdminException in project incubator-pulsar by apache.
the class PersistentTopicsImpl method terminateTopicAsync.
@Override
public CompletableFuture<MessageId> terminateTopicAsync(String topic) {
TopicName tn = validateTopic(topic);
final CompletableFuture<MessageId> future = new CompletableFuture<>();
try {
final WebTarget path = topicPath(tn, "terminate");
request(path).async().post(Entity.entity("", MediaType.APPLICATION_JSON), new InvocationCallback<MessageIdImpl>() {
@Override
public void completed(MessageIdImpl messageId) {
future.complete(messageId);
}
@Override
public void failed(Throwable throwable) {
log.warn("[{}] Failed to perform http post request: {}", path.getUri(), throwable.getMessage());
future.completeExceptionally(getApiException(throwable.getCause()));
}
});
} catch (PulsarAdminException cae) {
future.completeExceptionally(cae);
}
return future;
}
use of org.apache.pulsar.client.admin.PulsarAdminException in project incubator-pulsar by apache.
the class PersistentTopicsImpl method resetCursor.
@Override
public void resetCursor(String topic, String subName, MessageId messageId) throws PulsarAdminException {
try {
TopicName tn = validateTopic(topic);
String encodedSubName = Codec.encode(subName);
WebTarget path = topicPath(tn, "subscription", encodedSubName, "resetcursor");
request(path).post(Entity.entity(messageId, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
}
}
use of org.apache.pulsar.client.admin.PulsarAdminException in project incubator-pulsar by apache.
the class PersistentTopicsImpl method resetCursor.
@Override
public void resetCursor(String topic, String subName, long timestamp) throws PulsarAdminException {
try {
TopicName tn = validateTopic(topic);
String encodedSubName = Codec.encode(subName);
WebTarget path = topicPath(tn, "subscription", encodedSubName, "resetcursor", String.valueOf(timestamp));
request(path).post(Entity.entity("", MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
}
}
use of org.apache.pulsar.client.admin.PulsarAdminException in project incubator-pulsar by apache.
the class PersistentTopicsImpl method getList.
@Override
public List<String> getList(String namespace) throws PulsarAdminException {
try {
NamespaceName ns = NamespaceName.get(namespace);
WebTarget path = namespacePath(ns);
return request(path).get(new GenericType<List<String>>() {
});
} catch (Exception e) {
throw getApiException(e);
}
}
Aggregations