Questions tagged [spring-mono]
20 questions
55
votes
1 answer
Mono class in Java: what is, and when to use?
I have this following code:
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.BodyInserters;
import…

S.I.M.P.L.E
- 695
- 1
- 5
- 10
1
vote
1 answer
Writing imperative code in Project Reactor
I have a class with the following two methods.
public class Test1 {
public Mono blah1() {
Mono blah = Mono.just("blah1");
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
…

Brian
- 556
- 6
- 26
1
vote
1 answer
Updating Mono object by another Mono object
Dears,
I'm a stuck with implementing a function (it is basically an update operation) that's capable of taking a Mono as a param and return an updated version of Mono where:
the returned instance derives from a db query;
the updated version of Mono…

FrankBr
- 886
- 2
- 16
- 37
1
vote
2 answers
Difference between Mono.then and Mono.flatMap/map
Say I want to call a webservice1 and then call webservice2 if the first was successful.
I can do the following (just indicative psuedo code) :-
Mono.just(reqObj)
.flatMap(r -> callServiceA())
.then(() ->…

Jerald Baker
- 1,121
- 1
- 12
- 48
1
vote
1 answer
Spring Reactor - consuming Pageable endpoint
It's my first time working with Spring Reactor and I've faced the following challenge:
I have a service which allows to consume a number of records specified by page number and page size:
Mono…

Andrey Yaskulsky
- 2,458
- 9
- 39
- 81
1
vote
1 answer
How to generate a random string and push it out using Mono to be displayed in a browser every X seconds or with random delay through Spring Reactive?
I would like the browser to display the randomly generated string on the browser as soon as the API generates it using Spring Reactive Mono.
Following is my sample program that works, generates random string and displays it on the browser every…

Nital
- 5,784
- 26
- 103
- 195
0
votes
0 answers
Spring Reactive Programming - Immutable Objects
I have yet to come across guidelines of using immutable objects by Pivotal for Spring Reactive programming. I may have missed this as there is a lot of documentation. I know that in functional langauges such as Haskell all objects are immutable.…

shodz
- 344
- 3
- 13
0
votes
1 answer
handling Spring Reactor mono like an Optional for HTTP 404
I had understood Spring Reactor's Mono to be sort of like Optional, except that it doesn't start "pulling" data until I subscribe to it. I also understand that "pulling" may be from a WebClient, in which case I'll need to check for…

Garret Wilson
- 18,219
- 30
- 144
- 272
0
votes
0 answers
MongoSocketWriteException: Exception sending message
Caused by: java.io.EOFException: SSL peer shut down incorrectly
I am not unable to write to mongo cluster.
It suddenly stopped working, it was working fine.
I have attached the logs for your refernece.
Thanks
com.mongodb.MongoSocketWriteException:…

Kumar Gaurav
- 1
- 2
0
votes
0 answers
Mongo DB spring boot - Bson query
I am using spring-boot-starter-data-mongodb and I am creating a BSON query to execute a updateMany operation
The query is fairly simple. I want to find all documents whose _id is contained in String List
listOfStrings = List.of("123",…

Andre Silva
- 15
- 3
0
votes
0 answers
@DBRef annotation only storing ref to _id of other table
I have a user table and role table and in the user table I am referencing the Role table to store the full role document as an array. But upon creating a user with a role and querying it in Mongo I am only seeing this:
roles" : [
DBRef("roles",…

grummets
- 1
- 1
0
votes
2 answers
Spring Cloud : Supplier continuously publishing Kafka events instead of one?
Spring Cloud : Supplier continuously Kafka publishing events how to published only one ?
public static HashMap transactionsOfAccount = new HashMap<>(0);
public LinkedList lists = new…
0
votes
0 answers
Handle Webclient async calls exceptions for non REST calls
I am calling Spring webclient as follows and get Mono response (async). Please notice that the call is not blocked. I invoke this in a scheduled job, so this async call is not initiated by a REST call. Problem is when exception occurred, it will be…

Shehan Simen
- 1,046
- 1
- 17
- 28
0
votes
1 answer
Extract WebClient GET response values within a Spring Cloud Gateway filter
My end goal with this is to implement a way to make composite API calls within the body of a gateway route filter. I have a very basic demo application running on port 9000 and exposing a few endpoints. Here is the REST…

Hristo Naydenov
- 113
- 3
- 13
0
votes
1 answer
How to stop main thread to complete all Mono calls?
I'm making multiple mono calls to DB.And result of all Mono response is needed to compute final result which is written after declared Mono logic.
if (SomeObject.getAccountLevelActiveList() != null) {
…

John
- 59
- 6