reactive-streams

MongoDB Reactive Streams run-time dependency error with Alpakka Mongo Connector ClassNotFoundException

天大地大妈咪最大 提交于 2021-02-17 06:31:07
问题 I'm trying to integrate the Alpakka Mongo Connector into an application that heavily relies on the Akka libraries for stream processing. The application utilizes Akka HTTP as well. I am encountering a dependency issue at run-time. In particular, I'm getting a NoClassDefFoundError for some kind of Success/Failure wrappers when I try to use the MongoSink.insertOne method provided by the Mongo connector. A full stack-trace: java.lang.NoClassDefFoundError: com/mongodb/reactivestreams/client

transform vs transformDeferred

旧城冷巷雨未停 提交于 2021-02-08 10:11:10
问题 What is the difference between transform & transformDeferred in project reactor flux. Good example will be helpful. https://projectreactor.io/docs/core/release/reference/index.html#advanced-mutualizing-operator-usage 回答1: Most of the time, a Flux is "lazy": you declare a processing pipeline, but data only starts flowing once you subscribe to it. You can subscribe multiple times. This is called a cold Flux (and each time you subscribe to a cold source, the source generates its data anew for

transform vs transformDeferred

主宰稳场 提交于 2021-02-08 10:10:41
问题 What is the difference between transform & transformDeferred in project reactor flux. Good example will be helpful. https://projectreactor.io/docs/core/release/reference/index.html#advanced-mutualizing-operator-usage 回答1: Most of the time, a Flux is "lazy": you declare a processing pipeline, but data only starts flowing once you subscribe to it. You can subscribe multiple times. This is called a cold Flux (and each time you subscribe to a cold source, the source generates its data anew for

Akka Stream connect to multiple sinks

微笑、不失礼 提交于 2021-02-07 18:29:13
问题 I have implemented a custom component in akka stream which takes elements as input, groups and merges them based on a key and sends them out through one of a dozen outlets. You can think of this component as a kind of GroupBy component which does not partition the flow into subflows, but actual flows. In addition to partitioning incoming elements, it merges them into one element, i.e. there is some buffering happening inside the component such that 1 element in does not necessarily mean 1

Project Reactor: How to control Flux emission

眉间皱痕 提交于 2021-02-07 10:19:45
问题 I have a flux that emits some Date . This Date is mapped to 1024 simulated HTTP requests that I'm running on some Executer . What I'd like to do is waiting for all the 1024 HTTP requests before emitting the next Date . Currently when running, onNext() is called for many times and then it is stabilised on some steady rate. How can I change this behaviour? P.S. I'm willing to change to architecture, if needed. private void run() throws Exception { Executor executor = Executors

Project Reactor: How to control Flux emission

こ雲淡風輕ζ 提交于 2021-02-07 10:19:30
问题 I have a flux that emits some Date . This Date is mapped to 1024 simulated HTTP requests that I'm running on some Executer . What I'd like to do is waiting for all the 1024 HTTP requests before emitting the next Date . Currently when running, onNext() is called for many times and then it is stabilised on some steady rate. How can I change this behaviour? P.S. I'm willing to change to architecture, if needed. private void run() throws Exception { Executor executor = Executors

Stream response from HTTP client with Spring/Project reactor

主宰稳场 提交于 2021-01-28 12:20:08
问题 How to stream response from reactive HTTP client to the controller without having the whole response body in the application memory at any time? Practically all examples of project reactor client return Mono<T> . As far as I understand reactive streams are about streaming, not loading it all and then sending the response. Is it possible to return kind of Flux<Byte> to make it possible to transfer big files from some external service to the application client without a need of using a huge

Is it safe to use the same FluxSink from multiple threads concurrently

我怕爱的太早我们不能终老 提交于 2021-01-24 11:36:10
问题 I know a Publisher must not publish concurrently, but if I use Flux#create(FluxSink) , can I safely call FluxSink#next concurrently? In other words, does Spring have internal magic that ensures proper serial publishing of events even if FluxSink#next is called concurrently? public class FluxTest { private final Map<String, FluxSink<Item>> sinks = new ConcurrentHashMap<>(); // Store a new sink for the given ID public void start(String id) { Flux.create(sink -> sinks.put(id, sink)); } // Called

Is it safe to use the same FluxSink from multiple threads concurrently

一个人想着一个人 提交于 2021-01-24 11:36:07
问题 I know a Publisher must not publish concurrently, but if I use Flux#create(FluxSink) , can I safely call FluxSink#next concurrently? In other words, does Spring have internal magic that ensures proper serial publishing of events even if FluxSink#next is called concurrently? public class FluxTest { private final Map<String, FluxSink<Item>> sinks = new ConcurrentHashMap<>(); // Store a new sink for the given ID public void start(String id) { Flux.create(sink -> sinks.put(id, sink)); } // Called

Spring Reactive Stream - Unexpected Shutdown

巧了我就是萌 提交于 2021-01-02 03:10:17
问题 We are using Spring Cloud Reactive Streams with RabbitMQ. Spring Reactive Stream appears to acknowledge the message as soon as it pulls it off the queue. So any errors unhandled exceptions that happens during the message processing need to be handled in the application (which is a different than a non-reactive stream where unhandled exceptions can be thrown and a message would be rejected, thus sending it to a dead letter queue). How are we supposed to deal with a sudden shutdown in an