Search in sources :

Example 11 with RetentionPolicies

use of com.yahoo.pulsar.common.policies.data.RetentionPolicies in project pulsar by yahoo.

the class Namespaces method getRetention.

@GET
@Path("/{property}/{cluster}/{namespace}/retention")
@ApiOperation(value = "Get retention config on a namespace.")
@ApiResponses(value = { @ApiResponse(code = 403, message = "Don't have admin permission"), @ApiResponse(code = 404, message = "Namespace does not exist") })
public RetentionPolicies getRetention(@PathParam("property") String property, @PathParam("cluster") String cluster, @PathParam("namespace") String namespace) {
    validateAdminAccessOnProperty(property);
    Policies policies = getNamespacePolicies(property, cluster, namespace);
    if (policies.retention_policies == null) {
        return new RetentionPolicies(config().getDefaultRetentionTimeInMinutes(), config().getDefaultRetentionSizeInMB());
    } else {
        return policies.retention_policies;
    }
}
Also used : RetentionPolicies(com.yahoo.pulsar.common.policies.data.RetentionPolicies) Policies(com.yahoo.pulsar.common.policies.data.Policies) PersistencePolicies(com.yahoo.pulsar.common.policies.data.PersistencePolicies) RetentionPolicies(com.yahoo.pulsar.common.policies.data.RetentionPolicies) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation) ApiResponses(io.swagger.annotations.ApiResponses)

Aggregations

RetentionPolicies (com.yahoo.pulsar.common.policies.data.RetentionPolicies)11 Test (org.testng.annotations.Test)7 MockedPulsarServiceBaseTest (com.yahoo.pulsar.broker.auth.MockedPulsarServiceBaseTest)5 Consumer (com.yahoo.pulsar.client.api.Consumer)5 ConsumerConfiguration (com.yahoo.pulsar.client.api.ConsumerConfiguration)5 Message (com.yahoo.pulsar.client.api.Message)5 PersistencePolicies (com.yahoo.pulsar.common.policies.data.PersistencePolicies)5 Policies (com.yahoo.pulsar.common.policies.data.Policies)4 PulsarServerException (com.yahoo.pulsar.broker.PulsarServerException)3 RestException (com.yahoo.pulsar.broker.web.RestException)3 PulsarAdminException (com.yahoo.pulsar.client.admin.PulsarAdminException)3 ClientConfiguration (com.yahoo.pulsar.client.api.ClientConfiguration)3 PulsarClient (com.yahoo.pulsar.client.api.PulsarClient)3 NamespaceBundle (com.yahoo.pulsar.common.naming.NamespaceBundle)3 ApiOperation (io.swagger.annotations.ApiOperation)3 ApiResponses (io.swagger.annotations.ApiResponses)3 Field (java.lang.reflect.Field)3 Path (javax.ws.rs.Path)3 KeeperException (org.apache.zookeeper.KeeperException)3 Stat (org.apache.zookeeper.data.Stat)3