Search in sources :

Example 26 with PulsarAdminException

use of org.apache.pulsar.client.admin.PulsarAdminException in project incubator-pulsar by apache.

the class NamespacesImpl method splitNamespaceBundle.

@Override
public void splitNamespaceBundle(String namespace, String bundle, boolean unloadSplitBundles) throws PulsarAdminException {
    try {
        NamespaceName ns = NamespaceName.get(namespace);
        WebTarget path = namespacePath(ns, bundle, "split");
        request(path.queryParam("unload", Boolean.toString(unloadSplitBundles))).put(Entity.entity("", MediaType.APPLICATION_JSON), ErrorData.class);
    } catch (Exception e) {
        throw getApiException(e);
    }
}
Also used : NamespaceName(org.apache.pulsar.common.naming.NamespaceName) WebTarget(javax.ws.rs.client.WebTarget) PulsarAdminException(org.apache.pulsar.client.admin.PulsarAdminException)

Example 27 with PulsarAdminException

use of org.apache.pulsar.client.admin.PulsarAdminException in project incubator-pulsar by apache.

the class NamespacesImpl method setNamespaceAntiAffinityGroup.

@Override
public void setNamespaceAntiAffinityGroup(String namespace, String namespaceAntiAffinityGroup) throws PulsarAdminException {
    try {
        NamespaceName ns = NamespaceName.get(namespace);
        WebTarget path = namespacePath(ns, "antiAffinity");
        request(path).post(Entity.entity(namespaceAntiAffinityGroup, MediaType.APPLICATION_JSON), ErrorData.class);
    } catch (Exception e) {
        throw getApiException(e);
    }
}
Also used : NamespaceName(org.apache.pulsar.common.naming.NamespaceName) WebTarget(javax.ws.rs.client.WebTarget) PulsarAdminException(org.apache.pulsar.client.admin.PulsarAdminException)

Example 28 with PulsarAdminException

use of org.apache.pulsar.client.admin.PulsarAdminException in project incubator-pulsar by apache.

the class NamespacesImpl method unsubscribeNamespaceBundle.

@Override
public void unsubscribeNamespaceBundle(String namespace, String bundle, String subscription) throws PulsarAdminException {
    try {
        NamespaceName ns = NamespaceName.get(namespace);
        WebTarget path = namespacePath(ns, bundle, "unsubscribe", subscription);
        request(path).post(Entity.entity("", MediaType.APPLICATION_JSON), ErrorData.class);
    } catch (Exception e) {
        throw getApiException(e);
    }
}
Also used : NamespaceName(org.apache.pulsar.common.naming.NamespaceName) WebTarget(javax.ws.rs.client.WebTarget) PulsarAdminException(org.apache.pulsar.client.admin.PulsarAdminException)

Example 29 with PulsarAdminException

use of org.apache.pulsar.client.admin.PulsarAdminException in project incubator-pulsar by apache.

the class NamespacesImpl method getMaxConsumersPerTopic.

@Override
public int getMaxConsumersPerTopic(String namespace) throws PulsarAdminException {
    try {
        NamespaceName ns = NamespaceName.get(namespace);
        WebTarget path = namespacePath(ns, "maxConsumersPerTopic");
        return request(path).get(Integer.class);
    } catch (Exception e) {
        throw getApiException(e);
    }
}
Also used : NamespaceName(org.apache.pulsar.common.naming.NamespaceName) WebTarget(javax.ws.rs.client.WebTarget) PulsarAdminException(org.apache.pulsar.client.admin.PulsarAdminException)

Example 30 with PulsarAdminException

use of org.apache.pulsar.client.admin.PulsarAdminException in project incubator-pulsar by apache.

the class NamespacesImpl method setBacklogQuota.

@Override
public void setBacklogQuota(String namespace, BacklogQuota backlogQuota) throws PulsarAdminException {
    try {
        NamespaceName ns = NamespaceName.get(namespace);
        WebTarget path = namespacePath(ns, "backlogQuota");
        request(path).post(Entity.entity(backlogQuota, MediaType.APPLICATION_JSON), ErrorData.class);
    } catch (Exception e) {
        throw getApiException(e);
    }
}
Also used : NamespaceName(org.apache.pulsar.common.naming.NamespaceName) WebTarget(javax.ws.rs.client.WebTarget) PulsarAdminException(org.apache.pulsar.client.admin.PulsarAdminException)

Aggregations

PulsarAdminException (org.apache.pulsar.client.admin.PulsarAdminException)89 WebTarget (javax.ws.rs.client.WebTarget)57 NamespaceName (org.apache.pulsar.common.naming.NamespaceName)51 Test (org.testng.annotations.Test)18 ClientErrorException (javax.ws.rs.ClientErrorException)14 ExecutionException (java.util.concurrent.ExecutionException)13 WebApplicationException (javax.ws.rs.WebApplicationException)12 NotFoundException (org.apache.pulsar.client.admin.PulsarAdminException.NotFoundException)12 MockedPulsarServiceBaseTest (org.apache.pulsar.broker.auth.MockedPulsarServiceBaseTest)10 ServerErrorException (javax.ws.rs.ServerErrorException)9 ClusterData (org.apache.pulsar.common.policies.data.ClusterData)9 PulsarServerException (org.apache.pulsar.broker.PulsarServerException)8 PreconditionFailedException (org.apache.pulsar.client.admin.PulsarAdminException.PreconditionFailedException)7 NamespaceBundle (org.apache.pulsar.common.naming.NamespaceBundle)7 TopicName (org.apache.pulsar.common.naming.TopicName)6 PropertyAdmin (org.apache.pulsar.common.policies.data.PropertyAdmin)6 RestException (org.apache.pulsar.broker.web.RestException)5 List (java.util.List)4 PulsarAdmin (org.apache.pulsar.client.admin.PulsarAdmin)4 PersistencePolicies (org.apache.pulsar.common.policies.data.PersistencePolicies)4