Questions tagged [java-flow]
12 questions
11
votes
1 answer
How to read the body of a HttpRequest in Java 11?
In a test, I'd like to look inside the body of a HttpRequest. I'd like to get the body as a string. It seems that the only way to do that, is to subscribe to the BodyPublisher but how does that work?

progonkpa
- 3,590
- 9
- 31
- 50
6
votes
2 answers
Java 9 Behavior of Flow SubmissionPublisher offer method
I´ve been playing with Java Flow offer operator but after read the documentation and do my test I dont understand.
Here my test
@Test
public void offer() throws InterruptedException {
//Create Publisher for expected items Strings
…

paul
- 12,873
- 23
- 91
- 153
5
votes
2 answers
Publishing data on java 9 Flow to subscribers in a way that only one subscriber will consume it
Is there a way to publish data to subscribers in a way that only one subscriber will receive it ?
What i am trying to achieve is that the subscriber publisher model will work as a queue that has multiple readers but one publisher.
Once the publisher…

Roy Kornviets
- 51
- 2
5
votes
0 answers
Java Flow.Subscriber - How can I unsubscribe?
I'm creating an user event system using JDK 9 Flow API, so I have a room (which implements Flow.Subscriber), it may have many users and each user can offer (dispatch) updates at any time.
When a user enters the room, I subscribe the…

António Almeida
- 9,620
- 8
- 59
- 66
5
votes
3 answers
Run Flow in main thread
Again I´m comparing RxJava with Java 9 Flow. I see that Flow by default is asynchronously, and I was wondering if there´s a way to make it run synchronously.
Sometimes we just want to use it not for Nio but for sugar syntax, and have a more…

paul
- 12,873
- 23
- 91
- 153
4
votes
2 answers
Java 9 Flow define subscriber with lambdas
I start playing with Java 9 Flow API, and the first thing that I found and dont like, it´s seems like we cannot use lambdas when we pass a subscriber implementation into the publisher as we can do with RxJava
So I have to define and implement my own…

paul
- 12,873
- 23
- 91
- 153
3
votes
0 answers
Java Flow.Subscriber - How can I get the publisher of onComplete?
I'm creating an user event system using JDK 9 Flow API, so I have a room (which extends the UserSubscriver class above), it may have many users and each user can offer (dispatch) updates at any time.
public abstract class UserSubscriver implements…

António Almeida
- 9,620
- 8
- 59
- 66
3
votes
3 answers
Good implementation/support for java.util.concurrent.Flow.Processor
Recently, I found a good support for Publisher by projectreactor.io:
Flux.create(fluxSink -> {
for (int i = 0; i < 10; i++)
fluxSink.next(i);
fluxSink.complete();
})
.map(...)
…

Andrew Sasha
- 1,254
- 1
- 11
- 21
2
votes
1 answer
Synchronous SubmissionPublisher
Is it possible to make Subscriber run on the same thread as the Publisher (synchronously)?
I can use CompletableFuture, but it delivers only a single result. But what if I need many results delivered to the subscriber. Please look at this small…

Alex
- 87
- 1
- 1
- 5
2
votes
2 answers
Jasperreport problem wtih subreport using javaflow
I have a problem with subreport using javaflow with Jasperreport 6.7.0 according to The Definitive Guide to JasperReports – Teodor Danciu, Lucian Chirita, page 130. I need it to avoid different threads call when the report is calling in our…

Altiy Zemlytskiy
- 51
- 8
1
vote
2 answers
Why can I not access class variables from onComplete in Flow API Subscriber
Using the Java Flow API. I have a chain of Processors and a terminal Subscriber.
I have coded up Subscribers that have kept a count of items received that work fine with a SubmissionPublisher.
However, when I pass values on from a Processor (which…

JNeff
- 11
- 3
0
votes
0 answers
java reactive flow - can a subscriber return value?
I am trying to implement java reactive flow (observer design patter).
I made use of samples available. i have no problem sending values to the subscribers but i cannot make the subscriber to send the publisher back a value. Is there any way i can…

user3583323
- 1
- 1