use of io.vertx.core.AsyncResult in project vertx-proton by vert-x3.
the class ProtonSubscriberIntTest method createServer.
private ProtonServer createServer(Handler<ProtonConnection> serverConnHandler) throws InterruptedException, ExecutionException {
ProtonServer server = ProtonServer.create(vertx);
server.connectHandler(serverConnHandler);
FutureHandler<ProtonServer, AsyncResult<ProtonServer>> handler = FutureHandler.asyncResult();
server.listen(0, handler);
handler.get();
return server;
}
use of io.vertx.core.AsyncResult in project vertx-proton by vert-x3.
the class ProtonPublisherIntTest method createServer.
private ProtonServer createServer(Handler<ProtonConnection> serverConnHandler) throws InterruptedException, ExecutionException {
ProtonServer server = ProtonServer.create(vertx);
server.connectHandler(serverConnHandler);
FutureHandler<ProtonServer, AsyncResult<ProtonServer>> handler = FutureHandler.asyncResult();
server.listen(0, handler);
handler.get();
return server;
}
use of io.vertx.core.AsyncResult in project nem2-sdk-java by nemtech.
the class AccountRepositoryVertxImpl method getAccountsInfo.
@Override
public Observable<List<AccountInfo>> getAccountsInfo(List<Address> addresses) {
AccountIds accountIds = new AccountIds().addresses(addresses.stream().map(Address::plain).collect(Collectors.toList()));
Consumer<Handler<AsyncResult<List<AccountInfoDTO>>>> callback = handler -> getClient().getAccountsInfo(accountIds, handler);
return exceptionHandling(call(callback).flatMapIterable(item -> item).map(this::toAccountInfo).toList().toObservable());
}
use of io.vertx.core.AsyncResult in project nem2-sdk-java by nemtech.
the class AccountRepositoryVertxImpl method search.
@Override
public Observable<Page<AccountInfo>> search(AccountSearchCriteria criteria) {
Integer pageSize = criteria.getPageSize();
Integer pageNumber = criteria.getPageNumber();
String offset = criteria.getOffset();
Order order = toDto(criteria.getOrder());
AccountOrderByEnum orderBy = criteria.getOrderBy() == null ? null : AccountOrderByEnum.fromValue(criteria.getOrderBy().getValue());
String mosaicId = criteria.getMosaicId() == null ? null : criteria.getMosaicId().getIdAsHex();
Consumer<Handler<AsyncResult<AccountPage>>> callback = (handler) -> getClient().searchAccounts(pageSize, pageNumber, offset, order, orderBy, mosaicId, handler);
return exceptionHandling(call(callback).map(page -> this.toPage(page.getPagination(), page.getData().stream().map(this::toAccountInfo).collect(Collectors.toList()))));
}
use of io.vertx.core.AsyncResult in project nem2-sdk-java by nemtech.
the class NamespaceRepositoryVertxImpl method getNamespaceNames.
@Override
public Observable<List<NamespaceName>> getNamespaceNames(List<NamespaceId> namespaceIds) {
NamespaceIds ids = new NamespaceIds().namespaceIds(namespaceIds.stream().map(NamespaceId::getIdAsHex).collect(Collectors.toList()));
Consumer<Handler<AsyncResult<List<NamespaceNameDTO>>>> callback = handler -> client.getNamespacesNames(ids, handler);
return exceptionHandling(call(callback).flatMapIterable(item -> item).map(this::toNamespaceName).toList().toObservable());
}
Aggregations