Search in sources :

Example 1 with DeleteSchemaResponse

use of org.apache.pulsar.common.protocol.schema.DeleteSchemaResponse in project pulsar by yahoo.

the class SchemasImpl method deleteSchemaAsync.

@Override
public CompletableFuture<Void> deleteSchemaAsync(String topic, boolean force) {
    WebTarget path = schemaPath(TopicName.get(topic)).queryParam("force", Boolean.toString(force));
    final CompletableFuture<Void> future = new CompletableFuture<>();
    try {
        request(path).async().delete(new InvocationCallback<DeleteSchemaResponse>() {

            @Override
            public void completed(DeleteSchemaResponse deleteSchemaResponse) {
                future.complete(null);
            }

            @Override
            public void failed(Throwable throwable) {
                future.completeExceptionally(getApiException(throwable.getCause()));
            }
        });
    } catch (PulsarAdminException cae) {
        future.completeExceptionally(cae);
    }
    return future;
}
Also used : DeleteSchemaResponse(org.apache.pulsar.common.protocol.schema.DeleteSchemaResponse) CompletableFuture(java.util.concurrent.CompletableFuture) WebTarget(javax.ws.rs.client.WebTarget) PulsarAdminException(org.apache.pulsar.client.admin.PulsarAdminException)

Example 2 with DeleteSchemaResponse

use of org.apache.pulsar.common.protocol.schema.DeleteSchemaResponse in project incubator-pulsar by apache.

the class SchemasImpl method deleteSchemaAsync.

@Override
public CompletableFuture<Void> deleteSchemaAsync(String topic, boolean force) {
    WebTarget path = schemaPath(TopicName.get(topic)).queryParam("force", Boolean.toString(force));
    final CompletableFuture<Void> future = new CompletableFuture<>();
    try {
        request(path).async().delete(new InvocationCallback<DeleteSchemaResponse>() {

            @Override
            public void completed(DeleteSchemaResponse deleteSchemaResponse) {
                future.complete(null);
            }

            @Override
            public void failed(Throwable throwable) {
                future.completeExceptionally(getApiException(throwable.getCause()));
            }
        });
    } catch (PulsarAdminException cae) {
        future.completeExceptionally(cae);
    }
    return future;
}
Also used : DeleteSchemaResponse(org.apache.pulsar.common.protocol.schema.DeleteSchemaResponse) CompletableFuture(java.util.concurrent.CompletableFuture) WebTarget(javax.ws.rs.client.WebTarget) PulsarAdminException(org.apache.pulsar.client.admin.PulsarAdminException)

Example 3 with DeleteSchemaResponse

use of org.apache.pulsar.common.protocol.schema.DeleteSchemaResponse in project pulsar by apache.

the class SchemasImpl method deleteSchemaAsync.

@Override
public CompletableFuture<Void> deleteSchemaAsync(String topic) {
    TopicName tn = TopicName.get(topic);
    final CompletableFuture<Void> future = new CompletableFuture<>();
    try {
        request(schemaPath(tn)).async().delete(new InvocationCallback<DeleteSchemaResponse>() {

            @Override
            public void completed(DeleteSchemaResponse deleteSchemaResponse) {
                future.complete(null);
            }

            @Override
            public void failed(Throwable throwable) {
                future.completeExceptionally(getApiException(throwable.getCause()));
            }
        });
    } catch (PulsarAdminException cae) {
        future.completeExceptionally(cae);
    }
    return future;
}
Also used : DeleteSchemaResponse(org.apache.pulsar.common.protocol.schema.DeleteSchemaResponse) CompletableFuture(java.util.concurrent.CompletableFuture) PulsarAdminException(org.apache.pulsar.client.admin.PulsarAdminException) TopicName(org.apache.pulsar.common.naming.TopicName)

Aggregations

CompletableFuture (java.util.concurrent.CompletableFuture)3 PulsarAdminException (org.apache.pulsar.client.admin.PulsarAdminException)3 DeleteSchemaResponse (org.apache.pulsar.common.protocol.schema.DeleteSchemaResponse)3 WebTarget (javax.ws.rs.client.WebTarget)2 TopicName (org.apache.pulsar.common.naming.TopicName)1