Questions tagged [reactive-programming]
Reactive Programming is a programming paradigm oriented around data flows and the propagation of change.
5,671
questions
0
votes
1
answer
30
views
Use webflux to make asynchronous calls and then perform task on response
I need to make concurrent calls to an API with paginated responses and then perform asyonchronous tasks on each item of each of the responses.
A friend of mine suggested WebFlux was the way to go ...
1
vote
0
answers
48
views
spring boot can't find my repository after adding a new repository
GameRepository.java:
@Repository
public interface GameRepository extends MongoRepository<Game, String> {
}
GameRepositoryReactive.java:
@Repository
public interface GameRepositoryReactive ...
0
votes
1
answer
30
views
Unclear about how to structure a vertx-redis-client code
I'm trying to implement a compare-and-delete (CAD) function using the vertx-redis-client library.
I'm following this answer on how to do this. I've already implemented the Lua script method and that ...
1
vote
1
answer
37
views
How can I combine a Mono and a Flux
I am creating a Flux of Product and a Mono Category object that needs to be applied to the Products because all they all all to be grouped into the same category. I am attempting to add the category ...
0
votes
0
answers
17
views
Is this the correct way of using reactiveX in python?
I am trying to learn reactive programming in Python, And made a little script to track the battery plug events like this
from time import sleep
import reactivex as rx
import psutil
class ...
0
votes
0
answers
17
views
Webflux Mono Chaining - Multiple dependent service calls with exception handling not working in SpringBoot
I am new to Webclient and reactive programming , have to invoke multiple service which are dependent on, I am not able to handle the exception in each stage. Any help appreciated
ServiceOne to get ...
0
votes
1
answer
22
views
How map an exception from a Mono to another exception
I have an endpoint in Spring Webflux (Java 20) that receives a UUID string and I need to validate it using UUID.fromString. If the latter throws an exception because the String is malformed, how can ...
-2
votes
0
answers
106
views
java.time.format.DateTimeParseException: Text '25-Sep-2023 14:55' could not be parsed at index 3 [duplicate]
I have the above DateTimeParseException error only for the dates of September 2023, (the current month is Sept 2023). For the rest of the months, i.e. from October the code passes through. Adding the ...
0
votes
1
answer
18
views
ObservableCollection showing items in incorrect order after Clear
I have a ObservableCollection where I add items and occasionally Clear.
Then there is reactive pipeline where the idea is to have current contents of the ObservableCollection in insertion order.
...
0
votes
0
answers
29
views
Vert.x production use cases and production stability, proc and cons
Hi am thinking to give vert.x Eclipse project a try. I have used reactive programming using spring web flux. But vert.x is sounding interesting to me. But before starting and investing time i am ...
0
votes
1
answer
33
views
Handle slow producer with Project Reactor/WebFlux to avoid overloading it
Backpressure is a mechanism that allows the consumer to slow down the producer when it cannot keep up with the producer rates. Can we do it in the opposite way? This is the scenario:
There is an high ...
0
votes
1
answer
40
views
How to chain several operators onFailure?
I have a Mutiny reactive stream on an Uni where I want to implement the following behavior:
Log something if an error happens;
Retry five times;
If the retries exhaust, log another message and ...
0
votes
1
answer
62
views
Spring Reactive Restful APIs - Is it really a non-blocking model?
I know that is possible to build my entire Spring boot application in reactive way.
So if my application uses R2DBC, I can do something like:
@Repository
public interface PersonRepository extends ...
0
votes
1
answer
49
views
How can I observe a reactive property inside a class instance that can be overwritten? (C#)
I want to subscribe to a value inside a class, but the class can be overwritten at runtime.
So I believe I lose the link to the value and the subscriptions no longer get triggered.
So basically when ...
0
votes
0
answers
26
views
How to delay emission between elements in Reactor Scheduler?
Now the difference in the execution time of serviceBar.externalMethod1(string) and serviceBar.externalMethod2(string) is equal to the difference in the call delay of method1and method2. I need the ...
0
votes
1
answer
72
views
How can the ReactiveElasticsearchClient be enriched with headers from a Mono?
I am going to enrich the Spring Data Elasticsearch - ReactiveElasticsearchClient requests with a JWT (as authorization header) retrieved from the ReactiveSecurityContextHolder.
The deprecated version ...
0
votes
0
answers
20
views
Retrying and dropping erroneous elements of a Flux without pausing downstream demand for data during retry backoff period
I have a Flux of elements and need to attempt to process each element while retrying the processing of each element if an error occurs. After a maximum number of retries, I need to drop erroneous ...
1
vote
1
answer
19
views
What exactly triggers a re-compute()?
I have a very particular use case where I need to trigger a computed() reassessment. As far as I know, the recompute is triggered automatically once the state of a reactive variable used inside ...
0
votes
0
answers
34
views
Reactor StepVerifier with expectNoEvent / then
I've implemented a queuer in Spring WebFlux as I asked about here: Queuing up requests in Spring WebFlux
TL;DR is that it queues up incoming requests to an external API, and then batches them after ...
2
votes
1
answer
61
views
Call Rest APIs parallely and combina their results - Java + Quarkus
I need to call multiple APIs in parallel and combine their results as array and return to the consumer.
Here is some context:
I would get the list of "providers" in the request. This list ...
0
votes
1
answer
34
views
How to strip objects inside an array in Spring Webflux in order to get each object through an event
What I want to achieve is to stream the objects under the JSON property "ranges" through flux events in order to apply a backpreasure mechanism.
I have a Json string which looks like this:
{
...
0
votes
0
answers
18
views
State Flow to broadcast app state to different screens at the same time
I'm developing a fitness app and I use a wrapper around some data classes that contains information shared by all the screens , like info for the current user , what settings are used by the app etc., ...
0
votes
2
answers
31
views
How can I create a lazy RxJS observable that calculates value only on once, and only when first subscribed?
I have the following class:
class BucketManager {
private readonly bucketNames$ = new BehaviorSubject<string[] | null>(null)
bucketNames = this.bucketNames$.asObservable().pipe(filter(...
0
votes
1
answer
72
views
Angular Signal Based Components. How do I use signals: true property in component decorator?
I want to try out a signal based component as described here: https://github.com/angular/angular/discussions/49682
I get an error when trying to use signals: true in the component decorator. The error ...
2
votes
1
answer
42
views
How to remove one data from shiny when another is uploaded
To illustrate my problem through minimal example, Let's consider the below code (which serves as fully reproducible example).
library(shiny)
ui <- fluidPage(
fileInput("upload", NULL, ...
0
votes
1
answer
30
views
How do I modify the value of Mono in non-blocking fashion?
I am calling a third party library that returns value as type - Mono<String>. I have to modify the value of that string, lets say keep only the first 5 characters if the string is longer than ...
0
votes
1
answer
42
views
What are the alternative to RxJS's operators?
Suppose I have something like this:
submit(): void {
this.loading = true;
dataLength?: number = untracked(this.dataService.data)?.length;
this.dataService.addData(this.dataForm.value);
...
0
votes
0
answers
50
views
Angular RxJS start polling refresh data if any of the existing data items are still "In Progress"
We have a component where we are displaying some data with a status. The data is being provided by a service as an observable array. The service is creating the data stream from two separate api calls ...
0
votes
1
answer
28
views
Manipulate local variable inside the reactive map and return end result only
I was developing logic to calculate the summary details and return it after going through some db operations. It was like this
@Override
public Mono<ResponseEntity<?>> generateSummary(...
0
votes
0
answers
17
views
Not able to create the new instance while spring boot application is shutting down
I am using reactive library for Elastic Search Bulk processor for bulk indexing. My spring boot application is shutting down in some scenarios, but before shutting down completely, bulk processor is ...
1
vote
1
answer
36
views
Creating a Mono from certain elements of a Flux
I am trying to create a Mono from elements of a Flux. This mono will need to contain a certain number of elements.
I found a solution, which is use the Mono.create method, the takeUntil and onCancel ...
0
votes
0
answers
26
views
Is it possible to extract response body In Spring WebClient?
I want to intercept requests and responses with the body in Sprin WebClient. I'm unfamiliar with this technology and don't know how I should do it. My first idea was to use ExchangeFilterFunction and ...
2
votes
2
answers
107
views
Queuing up requests in Spring WebFlux
In my API I have a service that calls an external API. This external API has a cost per request. Hence I would like to queue up the requests to the external API.
This is how it looks today:
@Component
...
0
votes
0
answers
48
views
Control Flux emission rate based on downstream async task completion
TL;DR:
Need to slow (dynamically) cosmos Db querying Flux so downstream can publish messages (asynchronously) to service bus.
Full description:
I have a Flux that queries Cosmos DB and returns lots of ...
0
votes
1
answer
59
views
map vs. flatMap with Mono.fromSupplier for long-running operations [closed]
I'm using Project Reactor as part of a project using Spring WebFlux and learned that Flux.map should only be used for "simple" operations. From https://stackoverflow.com/a/49169314/947526:
...
0
votes
0
answers
17
views
Implementing Back Pressure on Service - Service REST calls
What is the correct pattern for creating back pressure on service to service API calls in reactive systems?
We have a service that reads a message from SQS, does a few REST calls, processes the data ...
0
votes
0
answers
37
views
How to close the connection to return a Mono<byte[]> while using Reactive Netty connect() without blocking?
I am creating an application that receives http requests and requires to connect with a tcp server to get the response. At the rest controller, I am returning a Mono<byte[]>.
In the service ...
0
votes
1
answer
41
views
Buffered and Reactive aggregation service
I am working on a buffered aggregation service.
The aggregation service calls 3 different services (let's call then s1, s2 and s3) and returns aggregated result.
The aggregation service is itself ...
0
votes
0
answers
24
views
Throttling and Bulking calls to a service
I am using spring webflux to create an aggregation service that acts as an aggregator/facade and calls other service and collect the results then sends them as an aggregate DTO.
To prevent overloading ...
1
vote
2
answers
45
views
Executing a synchornous method, but with a timeout, using System.Reactive
What's the correct way to call the Read method with a timeout?
public int Method()
{
return Read();
}
I've tried with this, but my application is shutting down completely when a timeout ...
0
votes
0
answers
31
views
Svelte reactive statements won't fire until after HMR update
I'm writing a large svelte app (HMR via vite), and at some point, something started blocking the reactive statements. It seems that the events don't fire, although somethings update (like stores etc.)...
0
votes
1
answer
26
views
How to load reactiveValues from disk without breaking obervers?
In order to save the state of a shiny application to the disk I am using the function reactiveValuesToList().
When I want to load the state from the disk I am using do.call(reactiveValues, ...) as ...
0
votes
1
answer
108
views
403 forbidden only when use Mono/Flux on a endpoint- Spring Security 6 - Spring Boot 3 - JWT -
I need to understand why my different endpoints of my controllers do not work or allow them to work reactively using Mono or Flux, if I do not use Mono or Flux simply all the authentication and JWT ...
0
votes
0
answers
10
views
Cannot mock a new item using a fully reactive angular approch
This tool creates a metadata for authors. All of the instance variables are Observables using an Async pipe. I can edit and save the mock data, but when I create a new item, it does not get added to ...
1
vote
1
answer
122
views
Handling an empty Mono
I am trying to write a reactive function that performs a certain task when the first Mono is non-empty, and a "fallback" task when the Mono is empty. This is what I have so far:
static Mono&...
1
vote
0
answers
74
views
How resolve 401 Unauthorized with EnableWebFluxSecurity
My code:
@Configuration
@EnableWebFluxSecurity
@EnableHotmartSecurity
@EnableReactiveMethodSecurity(useAuthorizationManager = true)
class HttpSecurityConfig {
@Bean
fun springSecurityFilterChain(...
0
votes
1
answer
67
views
How to process batch of elements in Flux in parallel environment
In the below piece of code, I see an IDE error for buffer. I want to be able to group elements in to batch of three using buffer but it isn't working.
My goal is, divide flux into parallel rails, and ...
0
votes
2
answers
151
views
How to stop reactivity of variable in vue 3?
I am working on nuxt 3 and I need to stop the reactivity of the reactive constant. As I have one formData object and Once we click on submit I need to remove some keys from the formData object.
I have ...
1
vote
0
answers
103
views
AWS S3 Async client download file impacting reactor netty event loop threads
I've a spring boot webflux application which connects to 5 different downstream services to get data using webclient, everything works well until I try to read a file from S3 periodically (using ...
0
votes
0
answers
22
views
Child component in Vue 3 is not updated
My app has a parent component that receives data after an API call and passes it to the child component (DropDown):
import { computed, onMounted } from 'vue';
import defaultService from '@/services/...