diff --git a/build.sbt b/build.sbt index 75d9ca6b..443c8498 100644 --- a/build.sbt +++ b/build.sbt @@ -7,7 +7,7 @@ version := "1.0" scalaVersion := "2.13.14" val pekkoVersion = "1.1.0-M1" -val pekkoHTTPVersion = "1.0.1" +val pekkoHTTPVersion = "1.1.0-M1" val pekkoConnectorVersion = "1.0.2" val pekkoConnectorKafkaVersion = "1.0.0" diff --git a/src/main/scala/akkahttp/WebsocketChatEcho.scala b/src/main/scala/akkahttp/WebsocketChatEcho.scala index e4c41230..fd506f95 100644 --- a/src/main/scala/akkahttp/WebsocketChatEcho.scala +++ b/src/main/scala/akkahttp/WebsocketChatEcho.scala @@ -12,7 +12,7 @@ import scala.collection.parallel.CollectionConverters.* import scala.concurrent.Future import scala.concurrent.duration.* /** - * A simple WebSocket chat system using only akka streams with the help of MergeHub Source and BroadcastHub Sink + * A simple WebSocket chat system using only pekko streams with the help of MergeHub Source and BroadcastHub Sink * See also: [[WebsocketEcho]] * * Initial version shamelessly stolen from: diff --git a/src/main/scala/sample/stream_shared_state/DownloaderRetry.java b/src/main/scala/sample/stream_shared_state/DownloaderRetry.java index c922d2d7..07f35e28 100644 --- a/src/main/scala/sample/stream_shared_state/DownloaderRetry.java +++ b/src/main/scala/sample/stream_shared_state/DownloaderRetry.java @@ -12,6 +12,7 @@ import org.apache.hc.core5.http.ClassicHttpResponse; import org.apache.hc.core5.http.HttpRequest; import org.apache.hc.core5.http.HttpResponse; +import org.apache.hc.core5.http.HttpStatus; import org.apache.hc.core5.http.io.HttpClientResponseHandler; import org.apache.hc.core5.http.protocol.HttpContext; import org.apache.hc.core5.util.TimeValue; @@ -113,7 +114,7 @@ public boolean retryRequest(HttpRequest request, IOException exception, int exec @Override public boolean retryRequest(HttpResponse response, int execCount, HttpContext context) { int httpStatusCode = response.getCode(); - if (httpStatusCode != 503) + if (httpStatusCode != HttpStatus.SC_SERVICE_UNAVAILABLE) return false; // retry only on HTTP 503 if (execCount >= maxRetriesCount) { diff --git a/src/main/scala/tools/HttpRequestRetryStrategyOpenAI.java b/src/main/scala/tools/HttpRequestRetryStrategyOpenAI.java index d5100fd7..cd6b4858 100644 --- a/src/main/scala/tools/HttpRequestRetryStrategyOpenAI.java +++ b/src/main/scala/tools/HttpRequestRetryStrategyOpenAI.java @@ -4,6 +4,7 @@ import org.apache.hc.client5.http.HttpRequestRetryStrategy; import org.apache.hc.core5.http.HttpRequest; import org.apache.hc.core5.http.HttpResponse; +import org.apache.hc.core5.http.HttpStatus; import org.apache.hc.core5.http.protocol.HttpContext; import org.apache.hc.core5.util.TimeValue; import org.json.JSONObject; @@ -67,7 +68,7 @@ public boolean retryRequest(HttpRequest request, IOException exception, int exec @Override public boolean retryRequest(HttpResponse response, int execCount, HttpContext context) { int httpStatusCode = response.getCode(); - if (httpStatusCode == 500 || httpStatusCode == 503) { + if (httpStatusCode == HttpStatus.SC_INTERNAL_SERVER_ERROR || httpStatusCode == HttpStatus.SC_SERVICE_UNAVAILABLE) { if (execCount >= maxRetriesCount) { LOGGER.warn("Request failed after: {} retries", execCount);