Get object from mono without blocking

Get object from mono without blocking

Oct 29, 2020 · var recommendations = ((XYZResponseMapper) responseMapper). just("cba")). I just cant figure out how i can do it. May 18, 2022 · I need to get a value that is on the object that returns from templateService. com Sep 27, 2023 · One way to handle obtaining an object from a Mono without blocking is by using the subscribe() method with a callback function. You fetch whatever you have from a database, you flatMap the result and in that you put it in your second collection, and then you return the mono to the calling client. switchIfEmpty(Mono. out::println); If you want to get an integer out of mono, then you can replace subscribe with block, but pay Jun 15, 2019 · Next, create a subscriber which is able to use the executor to execute the tasks while waiting for the result instead of completely blocking the thread. map method needs to work with the User itself and not with Mono<User>, the operator you should apply instead is . Aug 5, 2019 · If your application is a non-reactive application (not returning fluxes or monos to the calling clients) what you have to do is to use block() if you need the value. just("Data"); } // below is function for compose. bodyToMono(String. zip( int1, int2, //zip defaults to producing a Tuple2 //but for the 2 args version you can provide a BiFunction (a, b) -> a + b ); //if you want to verify, eg. I am not sure, but it might have to do with putting the Mono<Employee> in the ResponseEntity directly. Mar 6, 2022 · We are not going to rely on doOnNext() nor doOnSuccess() nor other similar method to try to work on an pre-defined variable accessToken (That's not a way to let Mono flow). Jan 31, 2019 · 0. Oct 14, 2020 · I have a method set up to handle these POST requests and I need to be able to extract the above JSON data from the request body WITHOUT BLOCKING. Note that each block() will trigger a new subscription: in other words, the result might miss signal from hot publishers. then(Function) was actually deprecated in 3. May 7, 2020 · Mono: Returns 0 or 1 element. This will unwrap your user from the Mono and will be trigger when the User "promise" is resolved. defaultIfEmpty(new ResponseEntity<>(HttpStatus. Hence, it’s more optimized compared with the flatMapMany operator. NOT_FOUND)); Yes, That worked. share(). Let’s go through one sample that is using the conditional Mono. Jun 10, 2019 · So there's a reactive spring repository service which provides on type of object. Jun 8, 2019 · The only difference is that in Mono#flatMap there is only at most one value to flatten, so a closer method would be Mono#flatMapMany (which results in a Flux) The bottom line, your transformation function inside Mono#flatmap should return a Publisher (Mono) for flatMap operator to subscribe to. // Perform your non-blocking operation and return a Mono. Sep 20, 2018 · If it's set to false I have to set extra details to null before returning the employee object. java. Reactive Streams gives us a common API for Reactive Programming in Java. Oct 17, 2022 · If it fails, the flow ends; no need to query the second endpoint. Similar to Spring WebFlux, it enables reactive programming, and is based on an event-driven structure. The method I have now looks something like this: public void requestBody(ServerRequest request) {. This merge Aug 29, 2023 · Converting Mono to Object in Java In Java, if you have a Mono (Mono of a generic Object) and you want to extract the value wrapped in the Mono and convert it to a regular object, you can do so using the Mono's inbuilt methods. Jul 21, 2018 · Don't block, subscribe. Jan 7, 2022 · A Flux object represents a reactive sequence of 0. Feb 18, 2023 · Ways to convert Flux into Collection. When doing it Summary. May 22, 2023 · 1. subscribe(result -> { System. toStream() (these are the "extractor" methods — they get you out of the Reactive types into a less flexible, blocking abstraction). (I think that what you mean by "fails most of the time Jan 5, 2021 · 1. Eventually I want to use this code inside CredentialsProvider implementation. If it is completely impossible to do that (for example, you're using a database that doesn't have a reactive driver), then you'll need to call block() to "exit" the reactive context and retrieve your value. println(value); // Output: Hello, World! In the above example, we create a Mono that emits the string "Hello May 8, 2018 · resultMono. please help modifying getBulkUserInfo or getUserDetails to get the Mono<User. May 26, 2021 · I need to make a call to API and get data from it. Edit: As per Nipuna's comments I tried this: Jan 17, 2019 · 16. 4. map(command -> "redirect:/recipe/" + command. During shutdown we can iterate on the list in the following way: for (Mono mono : specialList) { Object value = mono. } And that you change the mentioned method to: public Mono<User> findUserById(String user_id){. Basically combining the results from both Mono streams in order to perform save of another document and doing this in a non-blocking way. The callback function will be invoked when the Mono emits the object. flatMapIterable(list -> list) . Get String from Mono<String> in reactive java. They don’t Oct 29, 2023 · Extracting a Value from a Mono. Webflux get value from Mono. By definition. The method which calls filterByName is used in another reactive method: return Mono. 7 and will be removed in 3. Jul 17, 2023 · below is how to get the object and use subscribe to do next step . As you know, Mono is an asynchronous call that executes in a non-blocking way. just("abc"). Mono<List< Rule>> to Mono<List< RuleResult>> I have this, which works but blocking the execution seems not correct to me: List<Rule> RuleSet Jan 18, 2018 · One word about the methods you should not call on Flux and Mono. There should be no reason to call block. Code Link : https://github. But the return type of mapping method is another one type, which depends on locale. block() or Mono. A Mono is a stream of 0 to 1 element, whereas a Flux is a stream of 0 to N elements. When a request is made using WebClient, the thread that initiates the request continues its life without being blocked, thus providing an asynchronous structure. Flux also has converters collectList() and collectMap() that convert from Flux to Mono. Jan 13, 2020 · You can't use block method on main reactor thread. Nov 3, 2017 · The method Mono. Jan 6, 2022 · Question: Is theresponseMono. expectNext(11) . PS. Oct 23, 2020 · I tried couple of things but I end up making the Blocking list instead of Non-Blocking ));? Question: How can I achieve this? i. Apr 17, 2018 · Get early access and see previews of new features. The flatMap method is similar to the map method with the key difference that the supplier you provide to it should return a Mono<T> or Flux<T>. As far as your . OK); // Here you are suddenly creating a new mono, which tells me you deffo broke the chain and need to recreate it by doing Mar 24, 2020 · Even if you just . 1. May 16, 2022 · Requirement: given the list of Servers in a Flux, return the LOCAL server if it is present, OR return the DEV servers if the LOCAL server is not present, and must be done in a non-blocking way. subscribe(); All the code above will be executed by the current thread that called subscribe . OK)) . toFuture() or Flux. e. The greatest difference is that a Mono<T> can be fully lazy, whereas when you get hold of a Future<T>, the underlying processing has already started. java> or Flux<User. Mono and Flux are both reactive streams. With collectList you could transform Flux<TestClass> to Mono< List<TestClass>> – Aug 6, 2019 · Mono<Integer> userId = savedUserMono. 1 protocol. To return Mono<Integer> you can do the following: Mono<Integer> result = mono. service. I don't know how to do that with the Flux. map(this::doRequest); List<Person> personList = persons. Learn more about Labs How to return a Mono<ResponseEntity> where the response entity can be of two different types Jun 10, 2020 · My intent is to evaluate the result of a method call that returns a Mono<Boolean> type value and then determine a course of action based on that result. The method as above doesn't seem to work apparently. As a concrete example: Methods: Aug 14, 2019 · I would like to achieve a specific goal with Project Reactor flux and mono, which seems to be pretty simple at first look. You can of course use Mono or Flux internally in your application but in the end you must call block() to get the concrete value that you need to return to the calling client. 3. just(student) . Mono<List<String>> emptyList = Mono. May 10, 2022 · That mono may be eagerly subscribed after adding to the list, to start processing now, or . When calling it, the method block the current Thread. find publish the elements on a thread which is an instance of NonBlocking, from its Jun 3, 2018 · Since Webclient. In your case it may look like: Jun 13, 2016 · There is another way to subscribe to a sequence, which is to call Mono. log(); } Here, flatMapIterable takes the Mono ‘s List and converts it internally into a Flux of its elements. Jul 20, 2021 · Try zip:. Feb 9, 2021 · My question is as follows: how can the result from the Mono be used in order to verify that the correct Mono is there, and based on that save Parser Document. error(new Exception("Validation Failed"))); Please help me with a way to return a Jan 18, 2022 · getUserDetails Method returns Mono of Type JsonNode. Try to have callback methods that uses this "val" you are trying to retrieve and pass it to them without breaking the method chain. A Mono<T> is a Reactive Streams Publisher, also augmented with a lot of operators that can be used to generate, transform, orchestrate Mono sequences. But you can cancel them (which is better than nothing) Mono is async/non-blocking and can easily execute any call on different Thread by composing the main Mono with different operators. verifyComplete(); Apr 19, 2019 · I have a repository that returns a flux and wanted to set the result to another object which is expecting a list. I am feeling lost here and clueless. But my debugger is lost after receiving the response from repo as Mono object and applied block () to it. java> Jan 18, 2018 · The flatMap method. saveRecipeCommand(command). If you can continue without analysing the result immediately and inspect the result at future time, use CompletableFuture (java 8) Nov 18, 2021 · Teams. subscribe(); // ugly double subscribe() !! }); As a result I need to get 5. block may work when publish mono on some other thread but it's not a case. In fact so much so that we recently forbid to do so on some of the non-blocking Schedulers of Reactor by throwing an exception when using these APIs: Apr 12, 2022 · WebClient is a reactive client and the only way to use it with non-reactive Spring MVC is to block. It is a specialization of Flux that can emit at most 1 <T> element: a Mono is either valued (complete with element), empty (complete without element) or failed (error). just("Hello World"); mono. private final SelfEventLoopExecutor selfExec; private volatile boolean completed = false; . Q&A for work. just("Hello, World!"); System. With Flux, you can use . Jul 31, 2020 · Usually the approach is that the other method should take a Mono<String> jsonString. Jun 23, 2017 · This Mono. For ex: return Mono. HERE IS THE DETAILED CODE final Map<String, Object> parameters = new HashMap<>(); ShipperLoad shipperLoad = (ShipperLoad)bid. map(value -> doSomething(value)); But remember that in Reactor, nothing happens until subscribe, so don't forget to subscribe: result. You can create some helper method to do calculation on them. map { person ->. toString. . For example the reactive mongo repository you are using will be returning a Mono which has its own methods for handling if it is empty without needing to use an Optional as shown above. callMethod(eventId); // response object has ProductId, and other details. 1. map()/. And this will output the same “one“, “two“, “three“, “four“, and then terminate. Flux : Returns 0…N elements. But before execute 1, 2 and 3, 4. The second endpoint only takes 1 account number and returns its transactions (mono response). ) In this simple case, you could also use optionally use the double colon syntax for a more concise syntax: Mono<Integer> userId = savedUserMono. May 9, 2020 · 1. Getting Response Without Blocking. println(result); // Output: Hello World }); Dec 31, 2021 · In this article, we will learn to convert Mono to object java without block. Following example shows how to use Mono to get the response without blocking the request thread: Jan 8, 2024 · return monoList. @PostMapping. Netty is the default ClientHttpConnector. See full list on baeldung. Dec 6, 2022 · Using non-blocking calls I want to generically take a Mono and call a method that returns a Flux and for each item in the Flux, call a method that returns Mono to return a Flux which is a an aggregate object of Bar + Foo + Bar and has as many elements as the Flux method returns (will return). I tried converting Mono to Order object using block(). java>. From this data I take uniqueId and then call bunch of API's to get other data, and then finally combine all this data to new Object and return. To summarize, I need to retrieve theresponseMono as non-blocking. the problem is that when it gets to the last map, the object is not the same anymore and i cant get the value i need. As in many documentation suggests it is not recommendable to use as it is blocking the operation. Aug 6, 2020 · As @Thomas commented you are breaking some of the fundamentals of reactive coding and not getting the benefits by using block() and should read up on it more. Following is the code I have done. If the String isn't available yet (which Mono<String> allows), you can't get it except by waiting until it comes in and that's exactly what blocking is. getSimpleName()); It should be relatively obvious what is going on here -- we are mapping the object to the object's class name (all while staying inside mono) Sep 28, 2021 · The return statement calls a method that returns a Mono<UserProfile> which is then passed to another method that returns the List, but I cannot figure out how to subscribe to this to get the List so that my code compiles and works in a non-blocking way? Pick the first Mono source to emit any value and replay that signal, effectively behaving like the source that first emits an onNext. 0 because its behavior is slightly different from all the other then methods in Mono, so we foresaw people get confused like you just did. can someone help me understand why the block didn't work and the subscribe worked? what am I missing here? Jul 10, 2020 · the block() starts the request by internally synchronously subscribing to the Mono, and returns the resulting ClientResponse. By focusing all their power on a single channel, they can deliver more power to the speaker without wasting energy. collectMultimap(): convert sequence into a Mono<Map> that each Map’s key can be paired with multi Jul 23, 2020 · I have a list of Rules that return Mono<Result>, I need to execute them and return another List of Mono with the result of each function. You can do this by mapping Mono like such: Mono<String> mono = Mono. This is super basic beginner webflux. answered Jul 2, 2020 at 15:40. Here’s an example: Mono<String> mono = Mono. there i had tried to get a Mono from my repository of Mongo. Your option with the following code is actually ok: @GetMapping. block() non-blocking here? If not, what can be done to make is completely non-blocking. just(1, 2, 3) . Maybe there is a way to execute Mono on a different thread. filter(this::filterByName) . To extract a value from a Mono, we can use the block method, which will block the current thread until the Mono emits a value. public Mono<ResponseEntity<Void>> createUser(@RequestBody UserDto dto) {. But in case of Mono is it necessary ? Because there will be only one item flowing in my pipe. 0. Is there any other way to convert the Mono to Order Object. flatMap should be used for non-blocking operations, or in short anything which returns back Mono, Flux. map(User::getId); The resulting Mono, when subscribed Dec 31, 2021 · A Flux object represents a reactive sequence of 0. out. This should work: . Output Hello world! The Netty logs have been filtered from above output. subscribe() in your test, the app could exit immediately without waiting for the end of these two async sequences. So if the mapper function contained a long blocking operation the thread that called subscribe will be blocked as well. processData() . Jul 27, 2020 · Because request. Resolver resolver = data. Reactive programming is about building asynchronous, non-blocking and event-driven applications that can easily scale. in a test: StepVerifier. just(Person("name", "age:12")) . find returns a Flux/Mono/Publisher I assume? Then thats not because of collectList doesn't allow you to do that, thats because you are trying to run block on a thread which is a NonBlocking thread, I assume collection. It is completely impossible. flatMap(data -> {. But should you do that? When you mix things (reactive and blocking), things get out of control easily. May 6, 2023 · deferContextual can be used for the current context-based evaluation of publisher. The way to do that is . 2. defer(() -> monoOfEmptyList()); Sep 20, 2018 · 3. May 4, 2018 · Now, our main goal is to merge those to publishers and return single Mono object with the list of accounts taken from Flux without blocking the stream. The operations which are done synchronously. CompletableFuture is eager. May 11, 2021 · You just need to return the Mono, and Webflux will subscribe when required to handle your request. getId()); (assuming, of course, that your user has a getId() method, and the id is an integer. fromIterable(resolvedData). block() subscribes to this Mono instance and blocks until the response is received. Jun 29, 2019 · We first fetch the artists and map the response. com/dilipsundarraj1/ Nov 7, 2017 · I understand that it makes sense when my publisher publishes a list of items (For ex: Flux) the future items does not have to wait for the current item getting blocked by a blocking operation. However, mono block amps also have some disadvantages. What we should focus on is converting a mono to another mono, for example converting mono response to mono access token. var entity = new ResponseEntity<>(recommendations, nullHeaders, HttpStatus. insert(order) requires an object as input, but in the above code, I am passing Publisher type of Mono. Is there any other way to get the results as a list without blocking? The block is working but it is taking long time. Employee. To create one, you can use an empty Mono<Void>. Sample Usage. You can't postpone the execution. Returns that value, or null if the Mono completes empty. So like in your first example, you need to block. getLoad(); // getting supplier data from other Jul 1, 2019 · The toString will return you a String like "Mono@13254216541", because you are calling Mono. FYI - Mono object returning works fine in my code Mar 16, 2022 · You asked how to return an object without calling block, and i have told you. flatMap(val -> Mono. getResolver(); Oct 11, 2019 · the definition of block(): Subscribe to this Mono and block indefinitely until a next signal is received. To make the flow fully non-blocking, all components/functions should be reactive. Alternatively, you can write your hander in doOnNext instead of subscribe() public Mono<String> processData() {. If you are using WebFlux you are doing so because you want to build a reactive pipeline, if you are calling block you are not doing that. Is it possible to do this without block so my method can return a Mono. It’s important to note that even though it is, in fact, a non-blocking client and it belongs to the spring-webflux library, the solution offers support for both synchronous and asynchronous operations, making it suitable also for Sep 15, 2023 · I don't know how to extract Branch[] from Mono<Branch[]> in order to create a ResponseRepo. A Flux object represents a reactive sequence of 0. the definition of subscribe(): Subscribe to this Mono and request unbounded demand. I have POJO class. May 31, 2020 · I assume the Collection class is from some reactor library doing some tcp/http call?collection. // your logic here, I am assuming this is a WebClient call also. So we can then on each emit doOnNext and attach these to the artist. In the below example, if fieldAExists is true, I want to run the code that performs the update at the latter part of the addFieldA method. map(value -> value. N items, whereas a Mono object represents a single value or an empty (0. The following fragment of code illustrates how I used WebClient to communicate with other microservice, and then merge the response and result from repository to single Mono object. map(object -> object. mapReactive(request, response, useCaseId, variantName); //return type Recommendations. Have you ever wondered how to extract the String value from Mono<String>. subscribe(), within subscribe add a lambda function, with input say x, to retrieve the individual fields using the x Feb 11, 2022 · Yes, it is possible. You would need to switch to Spring WebFlux and also make createUser reactive. flatmap()/. Dec 10, 2023 · Additionally, mono block amps are known for their efficiency. map(user -> user. defer () method: public void whenEmptyList_thenMonoDeferExecuted() {. Reactor is a Reactive Streams library and, therefore, all of its operators support non-blocking back-pressure. Basically your approach with zipping two monos is correct. You could also handle this asynchronously by calling subscribe() on the Mono returned by the exchange() method, instead of block(). Mono<String> bodyData = request. bodyToMono(User. Assuming the call to the other service is done in the following method: public Mono<Whatever> callToAnotherService(User user){. 2. How can I send the entire Flux every 3 seconds to my view. A code example, in the "blocking-way" will be better than a long description: Mono Description. just(1); //or any other mono, including lazy one Mono<Integer> int2 = Mono. answered Jan 5, 2021 at 15:40. public static class LazyBlockingSubscriber<T> implements Subscriber<T> {. Mar 28, 2022 · as @Toerktumlare mentioned you could not get non-reactive response from the reactive code without blocking and to be honest it doesn't make sense. getTemplateById(id), need to take the property 'name' to put on the 'filename' (where i write NAMEPROPERTYHERE). from Mono<Mono<Object5>> and double subscribe. create(sum) . to Mono<Object5> and single subscribe. Spring WebFlux: Mono Flux Example. subscribe(mono -> { mono. class Employee { String name } I have Mono being returned on hitting a service, I need to extract the name from Mono as a string. 0. But I Actually want to return a Mono<User. just(10); //same Mono<Integer> sum = Mono. Transactions response doesn't contain account identifier, so my aim is simply generate a response like this: @Value(staticConstructor = "of") public class MyResponse {. We then merge these in a Flux#merge that will emit each Cover when they are available. Any relevant help links or solution will be greatly appreciated. return Flux. 1) result. Example code: Mono<Response> 1stAPIResponse = 1stAPI. Mono has a block() method that returns the value it holds. the map method takes in a lambda of type Function which takes in a parameter of one type and returns an object of a different type. CompletableFuture is async and can be non-blocking. flatMap. Have you ever wondered how to extract the value from Mono. With a typical cold Mono, nothing happens until you subscribe() to it, which makes it possible to pass the Mono around in the application and enrich it with operators along the way, before Mar 16, 2020 · Note that you can use a Mono to represent no-value asynchronous processes that only have the concept of completion (similar to a Runnable). This not only helps to reduce heat generation but also improves overall system performance. Any guidance or any official documentation Nov 16, 2021 · actually locationMap(), I'm populating from redis cache and from there I'm getting it as a Mono so can't change it to normal object and even the other methods are more complex and chained with others, here i have given more simple example so that I can get appropriate help from people. collectList(). Now there's a blocking algorithm which calls get method from repository then split result, then take String locale and then make from them all one response object. just(some object goes here) . Using the map method would result Jun 4, 2019 · This code return true when there is data returned for a relevant username. Connect and share knowledge within a single location that is structured and easy to search. I am looking for the relevant documentation on this as I want to learn it and not just looking for a yes or no. To know about Mono or Flux reactive stream, refer to this article. Using the block() Method The easiest way to convert Jun 16, 2020 · Here the method kieSession. In your case your manual subscription means the entire chain will actually be executed twice for each request - once to print the result out to the terminal, and once to return the result to the /test endpoint. The code works fine but I would like get out. I tried with map() also but it didn't work. Jul 13, 2020 · 4. One more thing, you shouldn't use the request's data in the body of your function, but in a map or flatMap function. class); Sep 24, 2021 · 1. block(); } @RequiredArgsConstructor @Getter static class Person { private final int id; } private Person doRequest(int id) { return new Person(id); } Feb 1, 2023 · Question: How can I return a boolean value after successful check of Mono<String> without using block or subscribe. Dec 12, 2022 · I get the the accounts failed and accounts which passed from two different methods , After i receive both failed and passed account i want to create a Payments object without blocking. class) returns a Mono of a User, you can call that Mono's map method. subscribe() might not be called meaning it will be only subscribed during shutdown. Jan 20, 2018 · Mono. collectSortedList(): accumulate sequence and sort into a Mono<List>. I tried the following but as per docs calling subscribe on collectList is blocking call. getName()) but this returns again a Mono but not a string. May 11, 2024 · In addition, the new client is a reactive, non-blocking solution that works over the HTTP/1. blockLast() to block until the flux completes. map should be used when you want to do the transformation of an object /data in fixed time. is there an analog flatMap for Zip? If you really want to block till you get the result, use blocking get() If you can wait for a specific period to know the status instead of infinite blocking duration, use get() with time-out. I've done this with RestTemplate, but I'd like to do it with WebClient in a non-blocking way. This is forbidden. public void processData() {. In case the Mono errors, the original exception is thrown (wrapped in a RuntimeException if it was a checked exception). . Mono<Integer> int1 = Mono. boundedElastic()) . collectMap(): convert sequence into a Mono<Map>. Jun 10, 2019 · The official path is block(), which should serve as a warning that you may be doing something wrong, because blocking a non-blocking system is like shooting yourself in the foot. Valued sources always "win" over an empty source (one that only emits onComplete) or a failing source (one that only emits onError). zipwith Apr 7, 2021 · My goal is pretty simple, but unfortunately, Im totaly newbie in reactive programming: having Mono &lt;User&gt; mono how to get User in easiest way without blocking threads? Dec 3, 2019 · I am new to reactor programming,and need some help on MONO/Flux. During the mapping we fetch each album cover and get a List<Mono<Cover>> bock. For more information about Reactive Programming you can take a look at the Reactive manifesto as well. block(); // (do something with value) } Feb 23, 2023 · Unlike RestTemplate, WebClient is asynchronous and non-blocking. Jul 21, 2019 · A list of mono is a flux and a flux can be used like this: @Test public void test() { Flux<Person> persons = Flux. block() calls were deprecated some time ago. Here's an example: Mono<String> mono = Mono. We will use Flux methods such as: collectList(): accumulate sequence into a Mono<List>. Repo record public record Repo(String name, Owner owner, Boolean fork) {} Branch record public record Branch(String name, Commit commit) {} Nov 22, 2021 · 4. filter method since it only allows you to examine one element at a time, and to perform that filtering you Aug 30, 2020 · The full answer is in the comments above but here is how the code was finally fixed: private Mono<Map<String, Object>> getValues(List<ResolvedData> resolvedData, HttpRequest httpRequest) {. block() is not recommended, the other way to retrieve the values from incoming httpresponse is to create a POJO in the calling application having the required fields. Then once the Mono is received, use Mono. getId() + "/show"); I'm not sure about the syntax but you should let the framework unwrap the result of the Mono. map(employee-> new ResponseEntity<>(employee, HttpStatus. They differ in what they express. Mono<Employee> m = m. Mar 3, 2019 · In this video, we will build an endpoint that returns a Mono and write a JUNIT test case using WebTestClient. Getting a String from a Mono<String> without a blocking call isn't easy, it's impossible. Right now I am using a a block on the stream to achieve this. 5. This is the syntactical difference. subscribe(); } This is actually what you do in a @Scheduled method which simply returns nothing and you explicitly subscribe to the Mono or Flux so that elements are emitted. Learn more about Teams Jan 9, 2023 · 1. I think you should try to return the modified Mono like this: return recipeService. When that is done, we just then and return the artist object. getClass(). But what I actually want is to retrieve only the "address" attribute from that returned Mono object and do some other processing. subscribeOn(Schedulers. return Mono. subscribe(System. I end up with the same opinion about usage of MinioAsyncClient. go ls rh sr im wd zn nk vp ek