Search in sources :

Example 41 with PulsarAdminException

use of com.yahoo.pulsar.client.admin.PulsarAdminException in project pulsar by yahoo.

the class NamespacesImpl method unsubscribeNamespaceBundle.

@Override
public void unsubscribeNamespaceBundle(String namespace, String bundle, String subscription) throws PulsarAdminException {
    try {
        NamespaceName ns = new NamespaceName(namespace);
        request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path(bundle).path("unsubscribe").path(subscription)).post(Entity.entity("", MediaType.APPLICATION_JSON), ErrorData.class);
    } catch (Exception e) {
        throw getApiException(e);
    }
}
Also used : NamespaceName(com.yahoo.pulsar.common.naming.NamespaceName) PulsarAdminException(com.yahoo.pulsar.client.admin.PulsarAdminException)

Example 42 with PulsarAdminException

use of com.yahoo.pulsar.client.admin.PulsarAdminException in project pulsar by yahoo.

the class NamespacesImpl method clearNamespaceBacklog.

@Override
public void clearNamespaceBacklog(String namespace) throws PulsarAdminException {
    try {
        NamespaceName ns = new NamespaceName(namespace);
        request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("clearBacklog")).post(Entity.entity("", MediaType.APPLICATION_JSON), ErrorData.class);
    } catch (Exception e) {
        throw getApiException(e);
    }
}
Also used : NamespaceName(com.yahoo.pulsar.common.naming.NamespaceName) PulsarAdminException(com.yahoo.pulsar.client.admin.PulsarAdminException)

Example 43 with PulsarAdminException

use of com.yahoo.pulsar.client.admin.PulsarAdminException in project pulsar by yahoo.

the class NamespacesImpl method setBacklogQuota.

@Override
public void setBacklogQuota(String namespace, BacklogQuota backlogQuota) throws PulsarAdminException {
    try {
        NamespaceName ns = new NamespaceName(namespace);
        request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("backlogQuota")).post(Entity.entity(backlogQuota, MediaType.APPLICATION_JSON), ErrorData.class);
    } catch (Exception e) {
        throw getApiException(e);
    }
}
Also used : NamespaceName(com.yahoo.pulsar.common.naming.NamespaceName) PulsarAdminException(com.yahoo.pulsar.client.admin.PulsarAdminException)

Example 44 with PulsarAdminException

use of com.yahoo.pulsar.client.admin.PulsarAdminException in project pulsar by yahoo.

the class NamespacesImpl method unload.

@Override
public void unload(String namespace) throws PulsarAdminException {
    try {
        NamespaceName ns = new NamespaceName(namespace);
        request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("unload")).put(Entity.entity("", MediaType.APPLICATION_JSON), ErrorData.class);
    } catch (Exception e) {
        throw getApiException(e);
    }
}
Also used : NamespaceName(com.yahoo.pulsar.common.naming.NamespaceName) PulsarAdminException(com.yahoo.pulsar.client.admin.PulsarAdminException)

Example 45 with PulsarAdminException

use of com.yahoo.pulsar.client.admin.PulsarAdminException in project pulsar by yahoo.

the class NamespacesImpl method setRetention.

@Override
public void setRetention(String namespace, RetentionPolicies retention) throws PulsarAdminException {
    try {
        NamespaceName ns = new NamespaceName(namespace);
        request(namespaces.path(ns.getProperty()).path(ns.getCluster()).path(ns.getLocalName()).path("retention")).post(Entity.entity(retention, MediaType.APPLICATION_JSON), ErrorData.class);
    } catch (Exception e) {
        throw getApiException(e);
    }
}
Also used : NamespaceName(com.yahoo.pulsar.common.naming.NamespaceName) PulsarAdminException(com.yahoo.pulsar.client.admin.PulsarAdminException)

Aggregations

PulsarAdminException (com.yahoo.pulsar.client.admin.PulsarAdminException)45 NamespaceName (com.yahoo.pulsar.common.naming.NamespaceName)30 Test (org.testng.annotations.Test)12 PulsarServerException (com.yahoo.pulsar.broker.PulsarServerException)7 MockedPulsarServiceBaseTest (com.yahoo.pulsar.broker.auth.MockedPulsarServiceBaseTest)7 NotFoundException (com.yahoo.pulsar.client.admin.PulsarAdminException.NotFoundException)7 NamespaceBundle (com.yahoo.pulsar.common.naming.NamespaceBundle)7 ClusterData (com.yahoo.pulsar.common.policies.data.ClusterData)7 WebApplicationException (javax.ws.rs.WebApplicationException)7 PreconditionFailedException (com.yahoo.pulsar.client.admin.PulsarAdminException.PreconditionFailedException)6 RestException (com.yahoo.pulsar.broker.web.RestException)5 ApiOperation (io.swagger.annotations.ApiOperation)5 ApiResponses (io.swagger.annotations.ApiResponses)5 Path (javax.ws.rs.Path)5 SubscriptionBusyException (com.yahoo.pulsar.broker.service.BrokerServiceException.SubscriptionBusyException)4 Consumer (com.yahoo.pulsar.client.api.Consumer)4 Producer (com.yahoo.pulsar.client.api.Producer)4 NamespaceBundles (com.yahoo.pulsar.common.naming.NamespaceBundles)4 PropertyAdmin (com.yahoo.pulsar.common.policies.data.PropertyAdmin)4 ClientErrorException (javax.ws.rs.ClientErrorException)4