use of com.yahoo.pulsar.common.naming.DestinationName in project pulsar by yahoo.
the class PersistentTopicsImpl method grantPermission.
@Override
public void grantPermission(String destination, String role, Set<AuthAction> actions) throws PulsarAdminException {
try {
DestinationName ds = DestinationName.get(destination);
request(persistentTopics.path(ds.getNamespace()).path(ds.getLocalName()).path("permissions").path(role)).post(Entity.entity(actions, MediaType.APPLICATION_JSON), ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
}
}
use of com.yahoo.pulsar.common.naming.DestinationName in project pulsar by yahoo.
the class PersistentTopicsImpl method expireMessagesAsync.
@Override
public CompletableFuture<Void> expireMessagesAsync(String destination, String subName, long expireTimeInSeconds) {
DestinationName ds = validateTopic(destination);
String encodedSubName = Codec.encode(subName);
return asyncPostRequest(persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscription").path(encodedSubName).path("expireMessages").path(String.valueOf(expireTimeInSeconds)), Entity.entity("", MediaType.APPLICATION_JSON));
}
use of com.yahoo.pulsar.common.naming.DestinationName in project pulsar by yahoo.
the class PersistentTopicsImpl method revokePermissions.
@Override
public void revokePermissions(String destination, String role) throws PulsarAdminException {
try {
DestinationName ds = DestinationName.get(destination);
request(persistentTopics.path(ds.getNamespace()).path(ds.getLocalName()).path("permissions").path(role)).delete(ErrorData.class);
} catch (Exception e) {
throw getApiException(e);
}
}
use of com.yahoo.pulsar.common.naming.DestinationName in project pulsar by yahoo.
the class PersistentTopicsImpl method skipAllMessagesAsync.
@Override
public CompletableFuture<Void> skipAllMessagesAsync(String destination, String subName) {
DestinationName ds = validateTopic(destination);
String encodedSubName = Codec.encode(subName);
return asyncPostRequest(persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscription").path(encodedSubName).path("skip_all"), Entity.entity("", MediaType.APPLICATION_JSON));
}
use of com.yahoo.pulsar.common.naming.DestinationName in project pulsar by yahoo.
the class PersistentTopicsImpl method getSubscriptionsAsync.
@Override
public CompletableFuture<List<String>> getSubscriptionsAsync(String destination) {
DestinationName ds = validateTopic(destination);
final CompletableFuture<List<String>> future = new CompletableFuture<>();
asyncGetRequest(persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscriptions"), new InvocationCallback<List<String>>() {
@Override
public void completed(List<String> response) {
future.complete(response);
}
@Override
public void failed(Throwable throwable) {
future.completeExceptionally(getApiException(throwable.getCause()));
}
});
return future;
}
Aggregations