I think you can do something like the following code.
The basic idea is that you are not directly using the HttpClientRequest received by the Vertx client. Instead, you create another current one that will call end() right after receiving the first subscription.
Here, for example, you can receive a request through a couple of custom methods: in this case request1() and request2() . They use doOnSubscribe() to run the end() that you need. Read its description on the ReactiveX page .
This example uses vertx and reactivex . I hope you can use this setting.
import io.reactivex.Flowable; import io.vertx.core.http.HttpMethod; import io.vertx.reactivex.core.Vertx; import io.vertx.reactivex.core.buffer.Buffer; import io.vertx.reactivex.core.http.HttpClient; import io.vertx.reactivex.core.http.HttpClientRequest; import io.vertx.reactivex.core.http.HttpClientResponse; import org.junit.Test; public class StackOverflow { @Test public void test(){ Buffer jsonData = Buffer.buffer("...");
source share