Code: Select all
public static String post(ActorSystem system, String uri, String json) throws Exception {
try {
HttpRequest post = HttpRequest.POST(uri).withEntity(HttpEntities.create(ContentTypes.APPLICATION_JSON, json));
return Http.get(system).singleRequest(post).thenCompose(response -> {
if (response.status().isFailure()) {
response.discardEntityBytes(system);
return CompletableFuture.completedFuture(null);
}
else{
return Unmarshaller.entityToString().unmarshal(response.entity(), system);
}
}).toCompletableFuture().get();
} catch (Exception e) {
throw e;
}
}
< /code>
Erhalten Sie manchmal diesen Fehler: < /p>
java.util.concurrent.TimeOutException: Die Antwortentität wurde nach 5 Sekunden nicht abonniert. Stellen Sie sicher, dass Sie die Antwort entity
Ich habe die Warnnote in https://doc.akka.io/libraries/akka-http sehen /current/client-sside/request-level.html
Wie kann ich dies in "else" -Fülle reparieren/lösen?
tnx < /p>
PS: Inkrement -Zeitüberschreitung ist eine schwache Lösung: (< /p>