Search in sources :

Example 1 with GetAllVersionsSchemaResponse

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

the class SchemasImpl method getAllSchemasAsync.

@Override
public CompletableFuture<List<SchemaInfo>> getAllSchemasAsync(String topic) {
    WebTarget path = schemasPath(TopicName.get(topic));
    TopicName topicName = TopicName.get(topic);
    final CompletableFuture<List<SchemaInfo>> future = new CompletableFuture<>();
    asyncGetRequest(path, new InvocationCallback<GetAllVersionsSchemaResponse>() {

        @Override
        public void completed(GetAllVersionsSchemaResponse response) {
            future.complete(response.getGetSchemaResponses().stream().map(getSchemaResponse -> convertGetSchemaResponseToSchemaInfo(topicName, getSchemaResponse)).collect(Collectors.toList()));
        }

        @Override
        public void failed(Throwable throwable) {
            future.completeExceptionally(getApiException(throwable.getCause()));
        }
    });
    return future;
}
Also used : GetAllVersionsSchemaResponse(org.apache.pulsar.common.protocol.schema.GetAllVersionsSchemaResponse) TopicName(org.apache.pulsar.common.naming.TopicName) IsCompatibilityResponse(org.apache.pulsar.common.protocol.schema.IsCompatibilityResponse) UTF_8(java.nio.charset.StandardCharsets.UTF_8) PulsarAdminException(org.apache.pulsar.client.admin.PulsarAdminException) IOException(java.io.IOException) CompletableFuture(java.util.concurrent.CompletableFuture) Schemas(org.apache.pulsar.client.admin.Schemas) DeleteSchemaResponse(org.apache.pulsar.common.protocol.schema.DeleteSchemaResponse) Collectors(java.util.stream.Collectors) Entity(javax.ws.rs.client.Entity) SchemaType(org.apache.pulsar.common.schema.SchemaType) LongSchemaVersionResponse(org.apache.pulsar.common.protocol.schema.LongSchemaVersionResponse) DefaultImplementation(org.apache.pulsar.client.internal.DefaultImplementation) List(java.util.List) GetSchemaResponse(org.apache.pulsar.common.protocol.schema.GetSchemaResponse) SchemaInfoWithVersion(org.apache.pulsar.common.schema.SchemaInfoWithVersion) Authentication(org.apache.pulsar.client.api.Authentication) InvocationCallback(javax.ws.rs.client.InvocationCallback) WebTarget(javax.ws.rs.client.WebTarget) PostSchemaPayload(org.apache.pulsar.common.protocol.schema.PostSchemaPayload) SchemaInfo(org.apache.pulsar.common.schema.SchemaInfo) CompletableFuture(java.util.concurrent.CompletableFuture) GetAllVersionsSchemaResponse(org.apache.pulsar.common.protocol.schema.GetAllVersionsSchemaResponse) List(java.util.List) WebTarget(javax.ws.rs.client.WebTarget) TopicName(org.apache.pulsar.common.naming.TopicName)

Example 2 with GetAllVersionsSchemaResponse

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

the class SchemasImpl method getAllSchemasAsync.

@Override
public CompletableFuture<List<SchemaInfo>> getAllSchemasAsync(String topic) {
    WebTarget path = schemasPath(TopicName.get(topic));
    TopicName topicName = TopicName.get(topic);
    final CompletableFuture<List<SchemaInfo>> future = new CompletableFuture<>();
    asyncGetRequest(path, new InvocationCallback<GetAllVersionsSchemaResponse>() {

        @Override
        public void completed(GetAllVersionsSchemaResponse response) {
            future.complete(response.getGetSchemaResponses().stream().map(getSchemaResponse -> convertGetSchemaResponseToSchemaInfo(topicName, getSchemaResponse)).collect(Collectors.toList()));
        }

        @Override
        public void failed(Throwable throwable) {
            future.completeExceptionally(getApiException(throwable.getCause()));
        }
    });
    return future;
}
Also used : GetAllVersionsSchemaResponse(org.apache.pulsar.common.protocol.schema.GetAllVersionsSchemaResponse) TopicName(org.apache.pulsar.common.naming.TopicName) IsCompatibilityResponse(org.apache.pulsar.common.protocol.schema.IsCompatibilityResponse) UTF_8(java.nio.charset.StandardCharsets.UTF_8) PulsarAdminException(org.apache.pulsar.client.admin.PulsarAdminException) IOException(java.io.IOException) CompletableFuture(java.util.concurrent.CompletableFuture) Schemas(org.apache.pulsar.client.admin.Schemas) DeleteSchemaResponse(org.apache.pulsar.common.protocol.schema.DeleteSchemaResponse) Collectors(java.util.stream.Collectors) Entity(javax.ws.rs.client.Entity) SchemaType(org.apache.pulsar.common.schema.SchemaType) LongSchemaVersionResponse(org.apache.pulsar.common.protocol.schema.LongSchemaVersionResponse) DefaultImplementation(org.apache.pulsar.client.internal.DefaultImplementation) List(java.util.List) GetSchemaResponse(org.apache.pulsar.common.protocol.schema.GetSchemaResponse) SchemaInfoWithVersion(org.apache.pulsar.common.schema.SchemaInfoWithVersion) Authentication(org.apache.pulsar.client.api.Authentication) InvocationCallback(javax.ws.rs.client.InvocationCallback) WebTarget(javax.ws.rs.client.WebTarget) PostSchemaPayload(org.apache.pulsar.common.protocol.schema.PostSchemaPayload) SchemaInfo(org.apache.pulsar.common.schema.SchemaInfo) CompletableFuture(java.util.concurrent.CompletableFuture) GetAllVersionsSchemaResponse(org.apache.pulsar.common.protocol.schema.GetAllVersionsSchemaResponse) List(java.util.List) WebTarget(javax.ws.rs.client.WebTarget) TopicName(org.apache.pulsar.common.naming.TopicName)

Example 3 with GetAllVersionsSchemaResponse

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

the class SchemasImpl method getAllSchemasAsync.

@Override
public CompletableFuture<List<SchemaInfo>> getAllSchemasAsync(String topic) {
    WebTarget path = schemasPath(TopicName.get(topic));
    TopicName topicName = TopicName.get(topic);
    final CompletableFuture<List<SchemaInfo>> future = new CompletableFuture<>();
    asyncGetRequest(path, new InvocationCallback<GetAllVersionsSchemaResponse>() {

        @Override
        public void completed(GetAllVersionsSchemaResponse response) {
            future.complete(response.getGetSchemaResponses().stream().map(getSchemaResponse -> convertGetSchemaResponseToSchemaInfo(topicName, getSchemaResponse)).collect(Collectors.toList()));
        }

        @Override
        public void failed(Throwable throwable) {
            future.completeExceptionally(getApiException(throwable.getCause()));
        }
    });
    return future;
}
Also used : GetAllVersionsSchemaResponse(org.apache.pulsar.common.protocol.schema.GetAllVersionsSchemaResponse) TopicName(org.apache.pulsar.common.naming.TopicName) IsCompatibilityResponse(org.apache.pulsar.common.protocol.schema.IsCompatibilityResponse) UTF_8(java.nio.charset.StandardCharsets.UTF_8) PulsarAdminException(org.apache.pulsar.client.admin.PulsarAdminException) IOException(java.io.IOException) CompletableFuture(java.util.concurrent.CompletableFuture) Schemas(org.apache.pulsar.client.admin.Schemas) DeleteSchemaResponse(org.apache.pulsar.common.protocol.schema.DeleteSchemaResponse) Collectors(java.util.stream.Collectors) Entity(javax.ws.rs.client.Entity) SchemaType(org.apache.pulsar.common.schema.SchemaType) LongSchemaVersionResponse(org.apache.pulsar.common.protocol.schema.LongSchemaVersionResponse) DefaultImplementation(org.apache.pulsar.client.internal.DefaultImplementation) List(java.util.List) GetSchemaResponse(org.apache.pulsar.common.protocol.schema.GetSchemaResponse) SchemaInfoWithVersion(org.apache.pulsar.common.schema.SchemaInfoWithVersion) Authentication(org.apache.pulsar.client.api.Authentication) InvocationCallback(javax.ws.rs.client.InvocationCallback) WebTarget(javax.ws.rs.client.WebTarget) PostSchemaPayload(org.apache.pulsar.common.protocol.schema.PostSchemaPayload) SchemaInfo(org.apache.pulsar.common.schema.SchemaInfo) CompletableFuture(java.util.concurrent.CompletableFuture) GetAllVersionsSchemaResponse(org.apache.pulsar.common.protocol.schema.GetAllVersionsSchemaResponse) List(java.util.List) WebTarget(javax.ws.rs.client.WebTarget) TopicName(org.apache.pulsar.common.naming.TopicName)

Aggregations

IOException (java.io.IOException)3 UTF_8 (java.nio.charset.StandardCharsets.UTF_8)3 List (java.util.List)3 CompletableFuture (java.util.concurrent.CompletableFuture)3 Collectors (java.util.stream.Collectors)3 Entity (javax.ws.rs.client.Entity)3 InvocationCallback (javax.ws.rs.client.InvocationCallback)3 WebTarget (javax.ws.rs.client.WebTarget)3 PulsarAdminException (org.apache.pulsar.client.admin.PulsarAdminException)3 Schemas (org.apache.pulsar.client.admin.Schemas)3 Authentication (org.apache.pulsar.client.api.Authentication)3 DefaultImplementation (org.apache.pulsar.client.internal.DefaultImplementation)3 TopicName (org.apache.pulsar.common.naming.TopicName)3 DeleteSchemaResponse (org.apache.pulsar.common.protocol.schema.DeleteSchemaResponse)3 GetAllVersionsSchemaResponse (org.apache.pulsar.common.protocol.schema.GetAllVersionsSchemaResponse)3 GetSchemaResponse (org.apache.pulsar.common.protocol.schema.GetSchemaResponse)3 IsCompatibilityResponse (org.apache.pulsar.common.protocol.schema.IsCompatibilityResponse)3 LongSchemaVersionResponse (org.apache.pulsar.common.protocol.schema.LongSchemaVersionResponse)3 PostSchemaPayload (org.apache.pulsar.common.protocol.schema.PostSchemaPayload)3 SchemaInfo (org.apache.pulsar.common.schema.SchemaInfo)3