Advertisement
shakasu

Untitled

Mar 11th, 2021
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.29 KB | None | 0 0
  1. public void transfusion(RequestInitiatingMigration request) {
  2.         URI senderURI = URI.create(request.getSender());
  3.         URI receiverURI = URI.create(request.getReceiver());
  4.  
  5.         tarantoolClient.graphql(TdgJsonUtils.paginationQuery(request), senderURI.getHost(), senderURI.getPort())
  6.                 .onSuccess(httpResp -> {
  7.                     List<JsonObject> mutations = TdgJsonUtils.convertToListMutations(httpResp.bodyAsJsonObject(), request);
  8.                     String cursor = TdgJsonUtils.getLastCursor(httpResp.bodyAsJsonObject(), request);
  9.                     while (!cursor.equals("empty")) {
  10.                         JsonObject response = tarantoolClient.graphql(
  11.                                 TdgJsonUtils.paginationQuery(request, cursor), senderURI.getHost(), senderURI.getPort())
  12.                                 .result().bodyAsJsonObject();
  13.                         mutations.addAll(TdgJsonUtils.convertToListMutations(response, request));
  14.                         cursor = TdgJsonUtils.getLastCursor(response, request);
  15.                     }
  16.  
  17.                     for (JsonObject mutation : mutations) {
  18.                         tarantoolClient.mutation(mutation, receiverURI.getHost(), receiverURI.getPort(), request.getToken());
  19.                     }
  20.                 });
  21.  
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement