use of org.apache.pulsar.common.protocol.schema.GetSchemaResponse 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;
}
use of org.apache.pulsar.common.protocol.schema.GetSchemaResponse in project pulsar by apache.
the class SchemasImpl method getSchemaInfoAsync.
@Override
public CompletableFuture<SchemaInfo> getSchemaInfoAsync(String topic, long version) {
TopicName tn = TopicName.get(topic);
WebTarget path = schemaPath(tn).path(Long.toString(version));
final CompletableFuture<SchemaInfo> future = new CompletableFuture<>();
asyncGetRequest(path, new InvocationCallback<GetSchemaResponse>() {
@Override
public void completed(GetSchemaResponse response) {
future.complete(convertGetSchemaResponseToSchemaInfo(tn, response));
}
@Override
public void failed(Throwable throwable) {
future.completeExceptionally(getApiException(throwable.getCause()));
}
});
return future;
}
use of org.apache.pulsar.common.protocol.schema.GetSchemaResponse in project pulsar by yahoo.
the class SchemasImpl method getSchemaInfoWithVersionAsync.
@Override
public CompletableFuture<SchemaInfoWithVersion> getSchemaInfoWithVersionAsync(String topic) {
TopicName tn = TopicName.get(topic);
final CompletableFuture<SchemaInfoWithVersion> future = new CompletableFuture<>();
asyncGetRequest(schemaPath(tn), new InvocationCallback<GetSchemaResponse>() {
@Override
public void completed(GetSchemaResponse response) {
future.complete(convertGetSchemaResponseToSchemaInfoWithVersion(tn, response));
}
@Override
public void failed(Throwable throwable) {
future.completeExceptionally(getApiException(throwable.getCause()));
}
});
return future;
}
use of org.apache.pulsar.common.protocol.schema.GetSchemaResponse in project pulsar by yahoo.
the class SchemasImpl method getSchemaInfoAsync.
@Override
public CompletableFuture<SchemaInfo> getSchemaInfoAsync(String topic, long version) {
TopicName tn = TopicName.get(topic);
WebTarget path = schemaPath(tn).path(Long.toString(version));
final CompletableFuture<SchemaInfo> future = new CompletableFuture<>();
asyncGetRequest(path, new InvocationCallback<GetSchemaResponse>() {
@Override
public void completed(GetSchemaResponse response) {
future.complete(convertGetSchemaResponseToSchemaInfo(tn, response));
}
@Override
public void failed(Throwable throwable) {
future.completeExceptionally(getApiException(throwable.getCause()));
}
});
return future;
}
use of org.apache.pulsar.common.protocol.schema.GetSchemaResponse in project incubator-pulsar by apache.
the class SchemasImpl method getSchemaInfoAsync.
@Override
public CompletableFuture<SchemaInfo> getSchemaInfoAsync(String topic, long version) {
TopicName tn = TopicName.get(topic);
WebTarget path = schemaPath(tn).path(Long.toString(version));
final CompletableFuture<SchemaInfo> future = new CompletableFuture<>();
asyncGetRequest(path, new InvocationCallback<GetSchemaResponse>() {
@Override
public void completed(GetSchemaResponse response) {
future.complete(convertGetSchemaResponseToSchemaInfo(tn, response));
}
@Override
public void failed(Throwable throwable) {
future.completeExceptionally(getApiException(throwable.getCause()));
}
});
return future;
}
Aggregations