Questions tagged [reactive-programming]

Reactive Programming is a programming paradigm oriented around data flows and the propagation of change.

Wiki

Reactive programming is a programming paradigm oriented around data flows and the propagation of change.

This means that it should be possible to express static or dynamic data flows with ease in the programming languages used, and that the underlying execution model will automatically propagate changes through the data flow.


Examples

In a Model-view-controller architecture, reactive programming can allow changes in the underlying model to automatically be reflected in the view, and vice versa.

Unlike Dataflow programming, reactive programming paradigm includes automatic update of variables if variables are dependent on other variables.


Related tags

5669 questions
2
votes
1 answer

Spring WebFlux switchIfEmpty to return different type

public Mono getMessage(ServerRequest request) { //this call returns Mono return apiClient.hystrixWrappedGetMessages(request.headers().asHttpHeaders(), request.queryParams()) .switchIfEmpty(/*…
2
votes
0 answers

Simultaneous calls block server

We have a service that is slow to respond for an average of 2 seconds whatever payload we send. We are batching multiple requests to save some bandwidth and don't choke that service. I have this client around WebClient to collect and execute…
2
votes
0 answers

Why WebFlux doesn't return value immediately as it was produced

As I understand, when Spring WebFlux should return the Flux of values, it would print and send values immediately as it was produced. But I have done some tests, and it returns all values only when all are produced (example code is below). Am I…
2
votes
2 answers

why deinit of view controller is not calling using RXSwift?

I tried a few things but couldn't find a solution. I am navigating the controller in the onNext block but the deinit is not calling. I have also declared the self as weak in the rx closures. Below is the complete class code. Please correct if I am…
Ale
  • 25
  • 8
2
votes
1 answer

vue 3 & typescript - Cannot access ComputedRef<> when it is located inside a reactive();

interface Intf { prop: ComputedRef; } const obj = {} as Intf; console.log(obj.prop.value); I have the above code which looks good as what I expected. I can access obj.prop.value and no error was thrown from typescript. However, when I…
mannok
  • 1,712
  • 1
  • 20
  • 30
2
votes
1 answer

how to chain reactive Mono(s) in an if-else scenario

New to Reactive Java here. Can someone please help with this simple scenario (written in Kotlin): fun testReactive(): Int { Mono.just("item-exists-in-database") .onErrorReturn("item-missing") // if item is not in database an…
Praveen Ray
  • 83
  • 1
  • 8
2
votes
1 answer

I cannot share my Observable stream properly and my http request calls twice

Hey I have a problem with share operator. When I use async pipe with data$ and totalElements$ my http request executes twice. I wish it would execute only once. I tried to use shareReplay istead and It did not work as well. filters$:…
2
votes
2 answers

Combine, map() vs tryMap() operators

I have been playing with Apple's Combine framework, There I found couple of operators map() & tryMap() or allSatisfy() & tryAllSatisfy many operators in Combine follows this pattern, I wonder what does this meant for. I gone through with many…
Nasir
  • 1,617
  • 2
  • 19
  • 34
2
votes
1 answer

How to use Spring WebClient to make a subsequent call with different header setting?

I need to call an third party API which requires an authentication call beforehand to get an authentication token. The Authentication API is in json but the subsequent call is in XML. I have separately…
LunaticJape
  • 1,446
  • 4
  • 21
  • 39
2
votes
2 answers

How can I orient an object on a tracked plane towards the camera in SparkAR Studio 98?

I am looking for a way to orient a sceneobject on a tracked plane towards the camera via scripting in SparkAR Studio 98. This sounds trivial, but I am having a very hard time finding the world position of the camera, and then from that generating a…
2
votes
2 answers

Flux: How to prevent element processing when some element has concrete value?

The following test method: @Test void testMe() { Flux.just(1, 2, 3, 4, 5) .map(this::saveInDb) .toStream().count(); } int saveInDb(int element) { System.out.println(element + " successfully stored in DB."); …
user471011
  • 7,104
  • 17
  • 69
  • 97
2
votes
0 answers

How to guard/lock entites in reactive pipelines between each subscription

How do I lock an entity in a Reactive context between each subscription? I have an endpoint to cancel an order. In the flow, I call some other services to cancel promotion and so on, and at last, I will mark Order in cancelled status and persist…
2
votes
3 answers

Reactive programming (Reactor) : Why main thread is stuck?

I'm learning Reactive programming with project-reactor. I have the following test case: @Test public void createAFlux_just() { Flux fruitFlux = Flux.just("apple", "orange"); fruitFlux.subscribe(f -> { try { …
user711189
  • 4,383
  • 4
  • 30
  • 48
2
votes
2 answers

With SwiftUI / Combine, How to avoid to put cancellables in ViewModel

I have always placed the DisposeBag in ViewController in MVVM with RxSwift like it said in this topic: On iOS, for the DisposeBag in MVVM, can it be placed in ViewModel? But with combine, since the View is a struct and cancelable can't be placed in…
Kevin ABRIOUX
  • 16,507
  • 12
  • 93
  • 99
2
votes
1 answer

Quarkus: execute parallel unis

In a quarkus / kotlin application, I want to start multiple database requests concurrently. I am new at quarkys and I am not sure if I am doing things right: val uni1 = Uni.createFrom().item(repo1).onItem().apply { it.request() } val uni2 =…
Rolintocour
  • 2,934
  • 4
  • 32
  • 63
1 2 3
99
100