use of com.yahoo.pulsar.common.naming.DestinationName in project pulsar by yahoo.
the class PersistentTopicsImpl method skipMessagesAsync.
@Override
public CompletableFuture<Void> skipMessagesAsync(String destination, String subName, long numMessages) {
DestinationName ds = validateTopic(destination);
String encodedSubName = Codec.encode(subName);
return asyncPostRequest(persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscription").path(encodedSubName).path("skip").path(String.valueOf(numMessages)), Entity.entity("", MediaType.APPLICATION_JSON));
}
use of com.yahoo.pulsar.common.naming.DestinationName in project pulsar by yahoo.
the class PersistentTopicsImpl method resetCursor.
@Override
public void resetCursor(String destination, String subName, long timestamp) throws PulsarAdminException {
try {
DestinationName ds = validateTopic(destination);
String encodedSubName = Codec.encode(subName);
request(persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("subscription").path(encodedSubName).path("resetcursor").path(String.valueOf(timestamp))).post(Entity.entity("", 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 getInternalStatsAsync.
@Override
public CompletableFuture<PersistentTopicInternalStats> getInternalStatsAsync(String destination) {
DestinationName ds = validateTopic(destination);
final CompletableFuture<PersistentTopicInternalStats> future = new CompletableFuture<>();
asyncGetRequest(persistentTopics.path(ds.getNamespace()).path(ds.getEncodedLocalName()).path("internalStats"), 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 com.yahoo.pulsar.common.naming.DestinationName in project pulsar by yahoo.
the class PersistentTopic method checkMessageExpiry.
@Override
public void checkMessageExpiry() {
DestinationName name = DestinationName.get(topic);
Policies policies;
try {
policies = brokerService.pulsar().getConfigurationCache().policiesCache().get(AdminResource.path("policies", name.getNamespace())).orElseThrow(() -> new KeeperException.NoNodeException());
if (policies.message_ttl_in_seconds != 0) {
subscriptions.forEach((subName, sub) -> sub.expireMessages(policies.message_ttl_in_seconds));
replicators.forEach((region, replicator) -> replicator.expireMessages(policies.message_ttl_in_seconds));
}
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug("[{}] Error getting policies", topic);
}
}
}
use of com.yahoo.pulsar.common.naming.DestinationName in project pulsar by yahoo.
the class PersistentTopic method getBacklogQuota.
/**
*
* @return Backlog quota for topic
*/
@Override
public BacklogQuota getBacklogQuota() {
DestinationName destination = DestinationName.get(this.getName());
String namespace = destination.getNamespace();
String policyPath = AdminResource.path("policies", namespace);
BacklogQuota backlogQuota = brokerService.getBacklogQuotaManager().getBacklogQuota(namespace, policyPath);
return backlogQuota;
}
Aggregations