Search in sources :

Example 1 with IsCompatibilityResponse

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

the class SchemasImpl method testCompatibilityAsync.

@Override
public CompletableFuture<IsCompatibilityResponse> testCompatibilityAsync(String topic, PostSchemaPayload payload) {
    TopicName tn = TopicName.get(topic);
    final CompletableFuture<IsCompatibilityResponse> future = new CompletableFuture<>();
    try {
        request(compatibilityPath(tn)).async().post(Entity.json(payload), new InvocationCallback<IsCompatibilityResponse>() {

            @Override
            public void completed(IsCompatibilityResponse isCompatibilityResponse) {
                future.complete(isCompatibilityResponse);
            }

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

Example 2 with IsCompatibilityResponse

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

the class SchemasImpl method testCompatibilityAsync.

@Override
public CompletableFuture<IsCompatibilityResponse> testCompatibilityAsync(String topic, PostSchemaPayload payload) {
    TopicName tn = TopicName.get(topic);
    final CompletableFuture<IsCompatibilityResponse> future = new CompletableFuture<>();
    try {
        request(compatibilityPath(tn)).async().post(Entity.json(payload), new InvocationCallback<IsCompatibilityResponse>() {

            @Override
            public void completed(IsCompatibilityResponse isCompatibilityResponse) {
                future.complete(isCompatibilityResponse);
            }

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

Example 3 with IsCompatibilityResponse

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

the class SchemasImpl method testCompatibilityAsync.

@Override
public CompletableFuture<IsCompatibilityResponse> testCompatibilityAsync(String topic, PostSchemaPayload payload) {
    TopicName tn = TopicName.get(topic);
    final CompletableFuture<IsCompatibilityResponse> future = new CompletableFuture<>();
    try {
        request(compatibilityPath(tn)).async().post(Entity.json(payload), new InvocationCallback<IsCompatibilityResponse>() {

            @Override
            public void completed(IsCompatibilityResponse isCompatibilityResponse) {
                future.complete(isCompatibilityResponse);
            }

            @Override
            public void failed(Throwable throwable) {
                future.completeExceptionally(getApiException(throwable.getCause()));
            }
        });
    } catch (PulsarAdminException cae) {
        future.completeExceptionally(cae);
    }
    return future;
}
Also used : CompletableFuture(java.util.concurrent.CompletableFuture) IsCompatibilityResponse(org.apache.pulsar.common.protocol.schema.IsCompatibilityResponse) 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 TopicName (org.apache.pulsar.common.naming.TopicName)3 IsCompatibilityResponse (org.apache.pulsar.common.protocol.schema.IsCompatibilityResponse)3