vttranlina commented on a change in pull request #711:
URL: https://github.com/apache/james-project/pull/711#discussion_r737314948



##########
File path: 
server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/push_subscription/WebPushClient.scala
##########
@@ -51,17 +51,17 @@ object WebPushClientHeader {
   val DEFAULT_TIMEOUT: Duration = Duration.of(30, ChronoUnit.SECONDS)
 }
 
-object PushServer {
-  type PushServerURL = String Refined Url
-
-  def validate(string: String): Either[IllegalArgumentException, PushServer] =
-    refined.refineV[Url](string)
-      .map(value => PushServer(value))
-      .left
-      .map(new IllegalArgumentException(_))
+object PushSubscriptionServerURL {
+  def from(value: String): Try[PushSubscriptionServerURL] = 
Try(PushSubscriptionServerURL(new URL(value)))
 }
 
-case class PushServer(url: PushServerURL)
+case class PushSubscriptionServerURL(value: URL)

Review comment:
       TODO: 
   Will merge with PushSubscriptionServerURL's POJO on 
https://github.com/apache/james-project/pull/707

##########
File path: 
server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/push_subscription/WebPushClient.scala
##########
@@ -86,16 +86,30 @@ class DefaultWebPushClient(configuration: 
PushClientConfiguration) extends WebPu
 
   val httpClient: HttpClient = buildHttpClient(configuration)
 
-  override def push(pushServer: PushServer, request: PushRequest): 
Publisher[Void] =
-    httpClient.baseUrl(pushServer.url.value)
+  override def push(pushServerUrl: PushSubscriptionServerURL, request: 
PushRequest): Publisher[Unit] =
+    httpClient
       .headers(builder => {
         builder.add(TIME_TO_LIVE, request.ttl.value.value)
         builder.add(MESSAGE_URGENCY, 
request.urgency.getOrElse(PushUrgency.default).value)
         request.topic.foreach(t => builder.add(TOPIC, t.value.value))
       })
       .post()
+      .uri(pushServerUrl.value.toString)
       .send(SMono.just(Unpooled.wrappedBuffer(request.payload)))
       .response()
-      .`then`()
+      .doOnNext(httpResponse => afterHTTPResponseHandler(httpResponse))
+//      .retryWhen(retrySpec)

Review comment:
       I want to retry the HTTP call to Push Server when error, But the reactor 
not working. 
   I don't know why
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to