reactive-programming

Automatic rate adjustment in Reactor

你说的曾经没有我的故事 提交于 2021-01-28 03:24:20
问题 TL;DR; Is there a way to automatically adjust delay between elements in Project Reactor based on downstream health? More details I have an application that reads records from Kafka topic, sends an HTTP request for each one of them and writes the result to another Kafka topic. Reading and writing from/to Kafka is fast and easy, but the third party HTTP service is easily overwhelmed, so I use delayElements() with a value from a property file, which means that this value does not change during

Is it possible to restart an IConnectableObservable?

时光怂恿深爱的人放手 提交于 2021-01-27 21:14:21
问题 I'm trying to figure out how to "restart" an IConnectableObservable after it has completed or errored. The code below shows two subscribers (A, B) to a connnectable observable. Once their subscription is disposed, a new subscriber (C) connects. I'd like it to appear to C that it is an entirely new observable, but I am only getting the exception raised in the first subscription. static void Main(string[] args) { var o = Observable.Create<string>(observer => { observer.OnNext("msg"); observer

Running histogram stream with Rx

有些话、适合烂在心里 提交于 2021-01-27 02:36:28
问题 I have the following single letter stream A B C A D B A C D And from this stream, I would like a stream of running count per letter (A,1) (A,1), (B,1) (A,1), (B,1), (C,1) (A,2), (B,1), (C,1) (A,2), (B,1), (C,1), (D,1) (A,2), (B,2), (C,1), (D,1) (A,3), (B,2), (C,1), (D,1) (A,3), (B,2), (C,2), (D,1) (A,3), (B,2), (C,2), (D,2) , i.e at each new letter, the totals are updated and emitted. I guess this problem is fairly language agnostic, so don't hesitate to propose a solution in your language of

Running histogram stream with Rx

元气小坏坏 提交于 2021-01-27 02:36:12
问题 I have the following single letter stream A B C A D B A C D And from this stream, I would like a stream of running count per letter (A,1) (A,1), (B,1) (A,1), (B,1), (C,1) (A,2), (B,1), (C,1) (A,2), (B,1), (C,1), (D,1) (A,2), (B,2), (C,1), (D,1) (A,3), (B,2), (C,1), (D,1) (A,3), (B,2), (C,2), (D,1) (A,3), (B,2), (C,2), (D,2) , i.e at each new letter, the totals are updated and emitted. I guess this problem is fairly language agnostic, so don't hesitate to propose a solution in your language of

Spring Cloud Gateway Routing Based On Content of the Request Body

China☆狼群 提交于 2021-01-24 08:13:27
问题 I need to create a reverse proxy that takes incoming request and based on the content of the request body, route the request to specific URI. This is for a routing micro service that acts like a reverse proxy and does routing based on some information from each request body. This means for each request I need to parse the request body and get the "username" field and then make a JDBC connection to fetch additional information from the database. Based on that information in database, it would

Spring Cloud Gateway Routing Based On Content of the Request Body

我的梦境 提交于 2021-01-24 08:12:39
问题 I need to create a reverse proxy that takes incoming request and based on the content of the request body, route the request to specific URI. This is for a routing micro service that acts like a reverse proxy and does routing based on some information from each request body. This means for each request I need to parse the request body and get the "username" field and then make a JDBC connection to fetch additional information from the database. Based on that information in database, it would

If I use a reactive client, should the server be reactive too?

China☆狼群 提交于 2021-01-01 08:50:22
问题 I want to use a reactive client (Reactive WebSocketClient i.e ReactorNettyWebSocketClient) to talk to a server which I don't know if it is reactive or not. Does it make sense to use a reactive client to talk to a server which is not reactive? I tried to connect to a server probably not reactive, and I got this error: io.netty.handler.codec.http.websocketx.WebSocketHandshakeException: Invalid handshake response getStatus: 999 Unknown at io.netty.handler.codec.http.websocketx

If I use a reactive client, should the server be reactive too?

馋奶兔 提交于 2021-01-01 08:50:15
问题 I want to use a reactive client (Reactive WebSocketClient i.e ReactorNettyWebSocketClient) to talk to a server which I don't know if it is reactive or not. Does it make sense to use a reactive client to talk to a server which is not reactive? I tried to connect to a server probably not reactive, and I got this error: io.netty.handler.codec.http.websocketx.WebSocketHandshakeException: Invalid handshake response getStatus: 999 Unknown at io.netty.handler.codec.http.websocketx

how save document to MongoDb with com.mongodb.reactivestreams.client

两盒软妹~` 提交于 2021-01-01 06:45:01
问题 I am trying to insert a document in MongoDb throw reactive driver: com.mongodb.reactivestreams.client According to official guide "... Only when a Publisher is subscribed to and data requested will the operation happen... Once the document has been inserted the onNext method will be called " and provided an example which I tried bellow without success. By debugging I see that onSubscribe is called but onNext bellow is never called and I checked in MongoDb the document isn't inserted also.

how save document to MongoDb with com.mongodb.reactivestreams.client

喜欢而已 提交于 2021-01-01 06:44:14
问题 I am trying to insert a document in MongoDb throw reactive driver: com.mongodb.reactivestreams.client According to official guide "... Only when a Publisher is subscribed to and data requested will the operation happen... Once the document has been inserted the onNext method will be called " and provided an example which I tried bellow without success. By debugging I see that onSubscribe is called but onNext bellow is never called and I checked in MongoDb the document isn't inserted also.