# backpressure

Published articles for backpressure.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Worker Backpressure (Part 1)

DevFeed: [Worker Backpressure (Part 1)](<https://devfeed.tech/articles/worker-backpressure-part-1-37935.md>)

Original publisher: [Read original article](<https://www.canva.dev/blog/engineering/worker-backpressure-part-1-how-we-taught-our-queue-workers-to-slow-down/>)

Author: Mikalai Barysau

Published: 2026-09-17T00:00:00Z

Content type: article

Language: en

Sources: [Canva Engineering](<https://devfeed.tech/sources/canva-engineering.md>)

Topics: [backpressure](<https://devfeed.tech/topics/backpressure.md>), [Back end](<https://devfeed.tech/topics/backend.md>), [reliability](<https://devfeed.tech/topics/reliability.md>)

Tags: [backend](<https://devfeed.tech/tags/backend.md>), [backpressure](<https://devfeed.tech/tags/backpressure.md>), [dependencies](<https://devfeed.tech/tags/dependencies.md>), [outage](<https://devfeed.tech/tags/outage.md>), [queue](<https://devfeed.tech/tags/queue.md>), [reliability](<https://devfeed.tech/tags/reliability.md>), [worker](<https://devfeed.tech/tags/worker.md>)

### AI overview

Canva describes Worker Backpressure, a reliability mechanism for queue workers that slows processing when dependencies fail and speeds it back up after recovery. During a cloud-provider outage, the mechanism helped prevent failed messages from accumulating on the Dead Letter Queue and avoided an on-call page.

### Source excerpt

How we taught Canva's queue workers to slow down when dependencies fail, then speed back up on their own.

## Broadcasting to 28K SSE Clients (and learning about Go channels)

DevFeed: [Broadcasting to 28K SSE Clients (and learning about Go channels)](<https://devfeed.tech/articles/broadcasting-to-28k-sse-clients-and-learning-about-go-channels-39405.md>)

Original publisher: [Read original article](<https://blog.pranshu-raj.in/posts/implementing-correct-fanout/>)

Author: Pranshu Raj

Published: 2026-07-23T00:00:00Z

Content type: tutorial

Language: en

Sources: [Pranshu Raj - blog on backend systems, performance and sidequests](<https://devfeed.tech/sources/pranshu-raj-blog-on-backend-systems-performance-and-sidequests.md>)

Topics: [Go Language](<https://devfeed.tech/topics/go-language.md>), [Server-sent events (SSE)](<https://devfeed.tech/topics/server-sent-events-sse.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [backpressure](<https://devfeed.tech/topics/backpressure.md>), [real-time](<https://devfeed.tech/topics/real-time.md>), [observability](<https://devfeed.tech/topics/observability.md>), [Redis](<https://devfeed.tech/topics/redis.md>), [Grafana](<https://devfeed.tech/topics/grafana.md>), [Prometheus](<https://devfeed.tech/topics/prometheus.md>)

Tags: [architecture](<https://devfeed.tech/tags/architecture.md>), [backpressure](<https://devfeed.tech/tags/backpressure.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [go](<https://devfeed.tech/tags/go.md>), [grafana](<https://devfeed.tech/tags/grafana.md>), [observability](<https://devfeed.tech/tags/observability.md>), [prometheus](<https://devfeed.tech/tags/prometheus.md>), [real-time](<https://devfeed.tech/tags/real-time.md>), [redis](<https://devfeed.tech/tags/redis.md>), [sse](<https://devfeed.tech/tags/sse.md>)

### AI overview

The article describes building a real-time leaderboard in Go that reached 28,232 concurrent SSE connections before exposing a broken broadcast design. It explains the fix using centralized polling, deduplication, fan-out, backpressure handling, and observability with Prometheus and Grafana.

### Source excerpt

A post on progressively getting my server to 28k SSE connections, finding a bug in my implementation of fan out using Go channels and the resulting mental model update.

## Backpressure in Distributed Systems

DevFeed: [Backpressure in Distributed Systems](<https://devfeed.tech/articles/backpressure-in-distributed-systems-39399.md>)

Original publisher: [Read original article](<https://blog.pranshu-raj.in/posts/backpressure/>)

Author: Pranshu Raj

Published: 2026-07-23T00:00:00Z

Content type: tutorial

Language: en

Sources: [Pranshu Raj - blog on backend systems, performance and sidequests](<https://devfeed.tech/sources/pranshu-raj-blog-on-backend-systems-performance-and-sidequests.md>)

Topics: [backpressure](<https://devfeed.tech/topics/backpressure.md>), [distributed-systems](<https://devfeed.tech/topics/distributed-systems.md>), [systems](<https://devfeed.tech/topics/systems.md>), [Messaging](<https://devfeed.tech/topics/messaging.md>), [real-time](<https://devfeed.tech/topics/real-time.md>)

Tags: [backpressure](<https://devfeed.tech/tags/backpressure.md>), [distributed](<https://devfeed.tech/tags/distributed.md>), [distributed-systems](<https://devfeed.tech/tags/distributed-systems.md>), [go](<https://devfeed.tech/tags/go.md>), [latency](<https://devfeed.tech/tags/latency.md>), [memory](<https://devfeed.tech/tags/memory.md>), [messages](<https://devfeed.tech/tags/messages.md>), [messaging](<https://devfeed.tech/tags/messaging.md>), [real-time](<https://devfeed.tech/tags/real-time.md>), [systems](<https://devfeed.tech/tags/systems.md>)

### AI overview

This tutorial explains backpressure in distributed systems, including how it occurs when message producers outpace consumers and the resulting risks such as memory exhaustion, dropped messages, lower throughput, network waste, increased latency, and blocked producers. It introduces producer, messaging-system, and consumer roles and relates the topic to a real-time leaderboard project.

### Source excerpt

Understanding what it is, how to deal with it, where it's used and how I handled it in the real time leaderboard.

## How We Cut Kafka Consumer Deployment Costs by 83%

DevFeed: [How We Cut Kafka Consumer Deployment Costs by 83%](<https://devfeed.tech/articles/how-we-cut-kafka-consumer-deployment-costs-by-83-28062.md>)

Original publisher: [Read original article](<https://tech.trivago.com/post/2026-06-12-how-we-cut-kafka-consumer-deployment-costs-by-83/>)

Author: ZhongLi Shen He creates fantastic software as a backend engineer GitHub profile Linkedin profile

Published: 2026-06-12T00:00:00Z

Content type: tutorial

Language: en

Sources: [Trivago](<https://devfeed.tech/sources/trivago.md>)

Topics: [Kafka](<https://devfeed.tech/topics/kafka.md>), [Deployer](<https://devfeed.tech/topics/deployer.md>), [Deployment](<https://devfeed.tech/topics/deployment.md>), [reactive](<https://devfeed.tech/topics/reactive.md>), [Library](<https://devfeed.tech/topics/library.md>)

Tags: [backend](<https://devfeed.tech/tags/backend.md>), [backpressure](<https://devfeed.tech/tags/backpressure.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [deployment](<https://devfeed.tech/tags/deployment.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [infrastructure](<https://devfeed.tech/tags/infrastructure.md>), [java](<https://devfeed.tech/tags/java.md>), [kafka](<https://devfeed.tech/tags/kafka.md>), [library](<https://devfeed.tech/tags/library.md>), [performance](<https://devfeed.tech/tags/performance.md>), [reactive](<https://devfeed.tech/tags/reactive.md>)

### AI overview

This post explains how trivago investigated PSE-kafka's low CPU usage, slow Kafka polling, and consumer lag. The investigation found that replacing the in-house KafkaReceiverFlux with spring-kafka removed the lag, while the team continued looking for a suitable fix that preserved pull-based consumption and backpressure. The changes ultimately cut infrastructure costs by 83% and ended a run of 19 P1 incidents.

### Source excerpt

This post walks through a layered performance investigation that cut PSE-kafka's infrastructure costs by 83% and ended a run of 19 P1 incidents.PSE-kafka (price-search-engine-kafka) i...

## Backpressure improvements help prevent data loss during ingestion traffic spikes

DevFeed: [Backpressure improvements help prevent data loss during ingestion traffic spikes](<https://devfeed.tech/articles/building-resilient-ingestion-with-smart-backpressure-handling-18391.md>)

Original publisher: [Read original article](<https://www.tinybird.co/blog/backpressure-improvements>)

Author: Javier Goizueta

Published: 2025-11-18T12:00:00Z

Content type: article

Language: en

Sources: [Tinybird](<https://devfeed.tech/sources/tinybird.md>)

Topics: [data](<https://devfeed.tech/topics/data.md>)

Tags: [backpressure](<https://devfeed.tech/tags/backpressure.md>), [data](<https://devfeed.tech/tags/data.md>), [engineering-excellence](<https://devfeed.tech/tags/engineering-excellence.md>)

### AI overview

The article explains that backpressure improvements help prevent data loss during traffic spikes and keep ingestion reliable when volume exceeds expectations.

### Source excerpt

Backpressure improvements prevent data loss during traffic spikes. Ingestion stays reliable even when volume exceeds expectations.

## Fearless Concurrency Ep.7: Lock-Free Structures and Channels for Scalable Rust Code

DevFeed: [Fearless Concurrency Ep.7: Lock-Free Structures and Channels for Scalable Rust Code](<https://devfeed.tech/articles/fearless-concurrency-ep-7-lock-free-structures-and-channels-for-scalable-rust-code-22272.md>)

Original publisher: [Read original article](<https://www.ardanlabs.com/blog/2024/12/fearless-concurrency-ep7-lock-free-structures-and-channels-for-scalable-rust-code.html>)

Published: 2024-12-05T00:00:00Z

Content type: tutorial

Language: en

Sources: [William Kennedy](<https://devfeed.tech/sources/william-kennedy.md>)

Topics: [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Rust](<https://devfeed.tech/topics/rust.md>), [Data structures](<https://devfeed.tech/topics/data-structures.md>), [Code](<https://devfeed.tech/topics/code.md>), [systems](<https://devfeed.tech/topics/systems.md>)

Tags: [advanced-rust-concurrency](<https://devfeed.tech/tags/advanced-rust-concurrency.md>), [alternatives](<https://devfeed.tech/tags/alternatives.md>), [backpressure](<https://devfeed.tech/tags/backpressure.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [concurrency-in-rust](<https://devfeed.tech/tags/concurrency-in-rust.md>), [crossbeam-crate-rust](<https://devfeed.tech/tags/crossbeam-crate-rust.md>), [efficient-multithreading-rust](<https://devfeed.tech/tags/efficient-multithreading-rust.md>), [fearless-concurrency-rust](<https://devfeed.tech/tags/fearless-concurrency-rust.md>), [lock-free](<https://devfeed.tech/tags/lock-free.md>), [lock-free-data-structures-rust](<https://devfeed.tech/tags/lock-free-data-structures-rust.md>), [managing-shared-resources-rust](<https://devfeed.tech/tags/managing-shared-resources-rust.md>), [mpsc-channels-rust](<https://devfeed.tech/tags/mpsc-channels-rust.md>), [one-shot-channels-rust](<https://devfeed.tech/tags/one-shot-channels-rust.md>), [optimizing-concurrency-in-rust](<https://devfeed.tech/tags/optimizing-concurrency-in-rust.md>), [performance](<https://devfeed.tech/tags/performance.md>), [robust-multithreaded-rust-apps](<https://devfeed.tech/tags/robust-multithreaded-rust-apps.md>), [rust](<https://devfeed.tech/tags/rust.md>), [rust-atomiccell](<https://devfeed.tech/tags/rust-atomiccell.md>), [rust-bounded-channels](<https://devfeed.tech/tags/rust-bounded-channels.md>), [rust-concurrency](<https://devfeed.tech/tags/rust-concurrency.md>), [rust-dashmap-dashset](<https://devfeed.tech/tags/rust-dashmap-dashset.md>), [rust-high-concurrency-techniques](<https://devfeed.tech/tags/rust-high-concurrency-techniques.md>), [rust-thread-multiplexing](<https://devfeed.tech/tags/rust-thread-multiplexing.md>), [rust-thread-safe-work-queues](<https://devfeed.tech/tags/rust-thread-safe-work-queues.md>), [rust-timeout-options](<https://devfeed.tech/tags/rust-timeout-options.md>), [scalable-rust-applications](<https://devfeed.tech/tags/scalable-rust-applications.md>), [thread](<https://devfeed.tech/tags/thread.md>), [thread-communication-rust](<https://devfeed.tech/tags/thread-communication-rust.md>)

### AI overview

The seventh and final episode of a Rust concurrency series covers lock-free data structures, channels for communication between threads, and techniques for managing shared resources. It discusses tools including DashMap, DashSet, Crossbeam, MPSC and one-shot channels, multiplexing, bounded channels, backpressure, memory usage, and timeouts.

### Source excerpt

Introduction: Welcome to Episode 7 of the Fearless Concurrency in Rust series! In this final episode, we explore advanced concurrency techniques that enable efficient, scalable, and robust multithreaded applications in Rust. The focus is on leveraging tools like lock-free data structures, channels for thread communication, and strategies for safely managing shared resources in complex systems. These approaches ensure developers can push the limits of Rust's concurrency model while maintaining safety and performance.

## Efficient data handling with the Streams API

DevFeed: [Efficient data handling with the Streams API](<https://devfeed.tech/articles/efficient-data-handling-with-the-streams-api-4046.md>)

Original publisher: [Read original article](<https://developer.mozilla.org/en-US/blog/efficient-data-handling-with-the-streams-api/>)

Author: vultr

Published: 2024-09-06T00:00:00Z

Content type: article

Language: en

Sources: [MDN Blog](<https://devfeed.tech/sources/mdn-blog.md>)

Topics: [Streaming](<https://devfeed.tech/topics/streaming.md>), [JavaScript](<https://devfeed.tech/topics/javascript.md>), [web applications](<https://devfeed.tech/topics/web-applications.md>), [API](<https://devfeed.tech/topics/api.md>), [Web Development](<https://devfeed.tech/topics/web-development.md>), [Command-line interface](<https://devfeed.tech/topics/cli.md>), [Firewall](<https://devfeed.tech/topics/firewall.md>), [ssh](<https://devfeed.tech/topics/ssh.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [backpressure](<https://devfeed.tech/tags/backpressure.md>), [data](<https://devfeed.tech/tags/data.md>), [efficiency](<https://devfeed.tech/tags/efficiency.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [performance](<https://devfeed.tech/tags/performance.md>), [stream](<https://devfeed.tech/tags/stream.md>), [streaming](<https://devfeed.tech/tags/streaming.md>), [streams](<https://devfeed.tech/tags/streams.md>), [web-applications](<https://devfeed.tech/tags/web-applications.md>)

### AI overview

This article explains how the Streams API lets JavaScript process network data incrementally as it arrives, instead of waiting for an entire resource to download. It covers chunk-based processing, backpressure, piping, and stream abstractions, then demonstrates a web application that transforms a data stream.

### Source excerpt

This post demonstrates how to use the Streams API in a web application to fetch and transform text on the fly. By processing the data as it arrives, this approach enhances performance, responsiveness, and resource efficiency.

## A Pattern for Composing Flow Operations

DevFeed: [A Pattern for Composing Flow Operations](<https://devfeed.tech/articles/a-pattern-for-composing-flow-operations-39359.md>)

Original publisher: [Read original article](<https://kt.academy/article/pattern_for_composing_flows>)

Published: 2024-04-15T00:00:00Z

Content type: tutorial

Language: en

Sources: [Kt. Academy](<https://devfeed.tech/sources/kt-academy.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [kotlin-coroutines](<https://devfeed.tech/topics/kotlin-coroutines.md>), [Streams](<https://devfeed.tech/topics/streams.md>), [async](<https://devfeed.tech/topics/async.md>), [backpressure](<https://devfeed.tech/topics/backpressure.md>), [flux](<https://devfeed.tech/topics/flux.md>), [RxJava](<https://devfeed.tech/topics/rxjava.md>)

Tags: [async](<https://devfeed.tech/tags/async.md>), [backpressure](<https://devfeed.tech/tags/backpressure.md>), [flux](<https://devfeed.tech/tags/flux.md>), [jpa](<https://devfeed.tech/tags/jpa.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-coroutines](<https://devfeed.tech/tags/kotlin-coroutines.md>), [rxjava](<https://devfeed.tech/tags/rxjava.md>), [streams](<https://devfeed.tech/tags/streams.md>), [workshop-learning-programming](<https://devfeed.tech/tags/workshop-learning-programming.md>)

### AI overview

This tutorial explains a pattern for composing Kotlin Flow operations by collecting one cold flow within another flow definition. It discusses sequential processing, asynchronous operations, and the limitations of using internal flow types when composing streams.

### Source excerpt

Extending and operating on top of your existing flows

## 3 (More) Tips for Optimizing Apache Flink Applications

DevFeed: [3 (More) Tips for Optimizing Apache Flink Applications](<https://devfeed.tech/articles/3-more-tips-for-optimizing-apache-flink-applications-1510.md>)

Original publisher: [Read original article](<https://shopify.engineering/optimizing-apache-flink-tips-part-two>)

Author: Kevin Lam

Published: 2022-12-13T14:00:00Z

Content type: tutorial

Language: en

Sources: [Shopify Engineering](<https://devfeed.tech/sources/shopify-engineering.md>), [Shopify Engineering - Shopify Engineering](<https://devfeed.tech/sources/shopify-engineering-shopify-engineering.md>)

Topics: [apache-flink](<https://devfeed.tech/topics/apache-flink.md>), [data-processing](<https://devfeed.tech/topics/data-processing.md>), [Streaming](<https://devfeed.tech/topics/streaming.md>), [data](<https://devfeed.tech/topics/data.md>)

Tags: [apache-flink](<https://devfeed.tech/tags/apache-flink.md>), [backpressure](<https://devfeed.tech/tags/backpressure.md>), [best-practices](<https://devfeed.tech/tags/best-practices.md>), [parallelism](<https://devfeed.tech/tags/parallelism.md>), [performance](<https://devfeed.tech/tags/performance.md>), [shopify](<https://devfeed.tech/tags/shopify.md>), [stateful](<https://devfeed.tech/tags/stateful.md>)

### AI overview

Shopify presents additional best practices for optimizing large, stateful Apache Flink applications. The supplied text covers selecting appropriate parallelism to scale execution and improve resource utilization, and avoiding bottlenecks in data sinks that can reduce throughput and cause backpressure.

### Source excerpt

Earlier this year, we shared our tips for optimizing large stateful Apache Flink applications. Below we'll walk you through 3 more best practices.

## Integrating Confluent Schema Registry with Apache Spark applications

DevFeed: [Integrating Confluent Schema Registry with Apache Spark applications](<https://devfeed.tech/articles/integrating-confluent-schema-registry-with-apache-spark-applications-24745.md>)

Original publisher: [Read original article](<https://medium.com/yazio-engineering/integrating-confluent-schema-registry-with-apache-spark-applications-d3426e33bc51?source=rss----65bd178b00af---4>)

Author: Dominik Liebler

Published: 2022-01-24T08:04:19Z

Content type: tutorial

Language: en

Sources: [YAZIO Engineering - Medium](<https://devfeed.tech/sources/yazio-engineering-medium.md>)

Topics: [Kafka](<https://devfeed.tech/topics/kafka.md>), [Apache Spark](<https://devfeed.tech/topics/spark.md>), [Streaming](<https://devfeed.tech/topics/streaming.md>), [data lake](<https://devfeed.tech/topics/data-lake.md>), [parquet](<https://devfeed.tech/topics/parquet.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Kubernetes](<https://devfeed.tech/topics/kubernetes.md>), [ceph](<https://devfeed.tech/topics/ceph.md>), [JSON Schema](<https://devfeed.tech/topics/json-schema.md>)

Tags: [apache-spark](<https://devfeed.tech/tags/apache-spark.md>), [backpressure](<https://devfeed.tech/tags/backpressure.md>), [ceph](<https://devfeed.tech/tags/ceph.md>), [confluent](<https://devfeed.tech/tags/confluent.md>), [data-engineering](<https://devfeed.tech/tags/data-engineering.md>), [data-lake](<https://devfeed.tech/tags/data-lake.md>), [data-pipeline](<https://devfeed.tech/tags/data-pipeline.md>), [json](<https://devfeed.tech/tags/json.md>), [kafka](<https://devfeed.tech/tags/kafka.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kubernetes](<https://devfeed.tech/tags/kubernetes.md>), [parquet](<https://devfeed.tech/tags/parquet.md>), [payload](<https://devfeed.tech/tags/payload.md>), [pipelines](<https://devfeed.tech/tags/pipelines.md>), [schema](<https://devfeed.tech/tags/schema.md>), [schemaregistry](<https://devfeed.tech/tags/schemaregistry.md>), [serialization](<https://devfeed.tech/tags/serialization.md>), [spark](<https://devfeed.tech/tags/spark.md>), [streaming](<https://devfeed.tech/tags/streaming.md>)

### AI overview

This engineering article explains YAZIO's data pipeline from mobile and web applications through Kafka and Spark Structured Streaming into a Ceph-based data lake. It discusses why schemas matter and describes replacing JSON with Apache Avro and Confluent Schema Registry to reduce message size while keeping schema information externally stored and cached.

### Source excerpt

At YAZIO, we believe in making decisions backed by data to help people live healthier lives through better nutrition. For each new and existing feature we want to evaluate how well it performs and how our users interact with it. In order to do so, we need a lot of data and we need to handle backpressure in our systems. To cope with that we use a Kafka cluster managed by Strimzi operators running in Kubernetes. The data itself is being ingested from our mobile and web apps via HTTP or TCP endpoints serialized into JSON and stored in Kafka by a small application written in Kotlin/JVM. Overview of our data pipeline architecture At the other end of the pipeline, different Spark Structured Streaming applications (also written in Kotlin) dump this information into our data lake residing in a Ceph bucket. They read data from Kafka, deserialize it, transform some of the fields and write Parquet files into the data lake using a new schema. Why schemas? Schemas play an important role in data pipelines because they give meaning and context to data. In a world without schemas we would still do random interpretations about the context and meaning of data every now and then when using it. As you might have guessed already this would lead to a lot of bugs and misunderstandings. Photo by EJ Strat https://unsplash.com/photos/VjWi56AWQ9k Similar to a legal contract that binds you to certain limits, a schema binds the data to certain limits and meaning which narrow down the need of interpretation. Choice of serialization formats At the time of writing, Confluent Schema Registry supports these three serialization formats: Apache Avro Protocol Buffers (protobuf) JSON Schema From those choices, only two really provide more than just validation of the data that is ingested and transmitted through our data pipelines. Avro and Protobuf also allow us to shrink the sizes of our topics because only the payload is contained in a message, while the repeating schema will not be stored. In the cas

## Java Reactive Programming - Effective Usage in a Real World Application

DevFeed: [Java Reactive Programming - Effective Usage in a Real World Application](<https://devfeed.tech/articles/java-reactive-programming-effective-usage-in-a-real-world-application-28008.md>)

Original publisher: [Read original article](<https://tech.trivago.com/post/2021-03-16-java-reactive-programming-real-world/>)

Author: Stefan Nothaas Java Software; Backend Engineer

Published: 2021-03-16T00:00:00Z

Content type: article

Language: en

Sources: [Trivago](<https://devfeed.tech/sources/trivago.md>)

Topics: [Java](<https://devfeed.tech/topics/java.md>), [reactive](<https://devfeed.tech/topics/reactive.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Back end](<https://devfeed.tech/topics/backend.md>), [Microservice](<https://devfeed.tech/topics/microservice.md>), [Kafka](<https://devfeed.tech/topics/kafka.md>), [API](<https://devfeed.tech/topics/api.md>)

Tags: [api](<https://devfeed.tech/tags/api.md>), [backend](<https://devfeed.tech/tags/backend.md>), [backpressure](<https://devfeed.tech/tags/backpressure.md>), [blocking](<https://devfeed.tech/tags/blocking.md>), [java](<https://devfeed.tech/tags/java.md>), [kafka](<https://devfeed.tech/tags/kafka.md>), [reactive](<https://devfeed.tech/tags/reactive.md>), [reactive-programming](<https://devfeed.tech/tags/reactive-programming.md>), [services](<https://devfeed.tech/tags/services.md>)

### AI overview

This article explains how trivago's search backend team applied reactive programming in Java to a production microservice. It covers handling blocking I/O, backpressure, varying loads, message and error propagation, and implementation challenges.

### Source excerpt

This article presents how trivago's search backend team used reactive programming in Java effectively when designing and implementing one of our many Java backend services. Compared to tradi...

## From RxJava to Kotlin Flow: Throttling

DevFeed: [From RxJava to Kotlin Flow: Throttling](<https://devfeed.tech/articles/from-rxjava-to-kotlin-flow-throttling-38630.md>)

Original publisher: [Read original article](<https://krossovochkin.com/posts/2020_03_02_from_rxjava_to_kotlin_flow_throttling/>)

Published: 2020-03-02T00:00:00Z

Content type: tutorial

Language: en

Sources: [Vasya Drobushkov](<https://devfeed.tech/sources/vasya-drobushkov.md>)

Topics: [reactive](<https://devfeed.tech/topics/reactive.md>), [kotlin-flow](<https://devfeed.tech/topics/kotlin-flow.md>), [RxJava](<https://devfeed.tech/topics/rxjava.md>), [Programming](<https://devfeed.tech/topics/programming.md>)

Tags: [backpressure](<https://devfeed.tech/tags/backpressure.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-flow](<https://devfeed.tech/tags/kotlin-flow.md>), [reactive](<https://devfeed.tech/tags/reactive.md>), [reactive-programming](<https://devfeed.tech/tags/reactive-programming.md>), [rxjava](<https://devfeed.tech/tags/rxjava.md>)

### AI overview

A comparison of throttling operators in RxJava and Kotlin Flow, explaining how debounce, throttleLast or sample, and throttleFirst limit events in reactive streams. The article uses UI interactions such as search input and button clicks as examples.

### Source excerpt

Source This post is part of series of comparing RxJava to Kotlin Flow. Previous articles were about Threading, Backpressure, Error Handling, Stream Types It is advised to take a look at the overview of Throttling operators in RxJava before reading this article: Throttling in RxJava 2 Introduction Throttling is also one of the essential features of reactive programming. Streams might emit more values than we're expecting to receive, so ability to limit number of events in a stream is very important. Most common place where it applies is handling UI events. Examples of usage might be handling button clicks (to not allow double clicks), usage with search view when we'd like to wait for user to stop typing before querying some data and so on. In this article we'll try to compare throttling operators in RxJava and Kotlin Flow.

## From RxJava to Kotlin Flow: Stream Types

DevFeed: [From RxJava to Kotlin Flow: Stream Types](<https://devfeed.tech/articles/from-rxjava-to-kotlin-flow-stream-types-38629.md>)

Original publisher: [Read original article](<https://krossovochkin.com/posts/2020_02_26_from_rxjava_to_kotlin_flow_stream_types/>)

Published: 2020-02-26T00:00:00Z

Content type: tutorial

Language: en

Sources: [Vasya Drobushkov](<https://devfeed.tech/sources/vasya-drobushkov.md>)

Topics: [kotlin-flow](<https://devfeed.tech/topics/kotlin-flow.md>), [RxJava](<https://devfeed.tech/topics/rxjava.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [reactive](<https://devfeed.tech/topics/reactive.md>), [backpressure](<https://devfeed.tech/topics/backpressure.md>)

Tags: [backpressure](<https://devfeed.tech/tags/backpressure.md>), [flow](<https://devfeed.tech/tags/flow.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-flow](<https://devfeed.tech/tags/kotlin-flow.md>), [reactive](<https://devfeed.tech/tags/reactive.md>), [reactive-programming](<https://devfeed.tech/tags/reactive-programming.md>), [rxjava](<https://devfeed.tech/tags/rxjava.md>)

### AI overview

This article compares stream types in RxJava and Kotlin Flow as part of a migration series. It explains RxJava's Observable, Flowable, Single, Maybe, and Completable, then maps them to Kotlin Flow or suspending functions and highlights differences in backpressure and stream composition.

### Source excerpt

Source This post is part of series of comparing RxJava to Kotlin Flow. Previous articles were about Threading, Backpressure, Error Handling Introduction In reactive programming we use streams. Therefore in both RxJava and Kotlin Flow we'll have to use some streams. Though we'll encounter some differences if we decide to migrate. In this article we'll try to get into the stream types which have RxJava and Kotlin Flow and some important differences.

## From RxJava to Kotlin Flow: Backpressure

DevFeed: [From RxJava to Kotlin Flow: Backpressure](<https://devfeed.tech/articles/from-rxjava-to-kotlin-flow-backpressure-38626.md>)

Original publisher: [Read original article](<https://krossovochkin.com/posts/2020_02_06_from_rxjava_to_kotlin_flow_backpressure/>)

Published: 2020-02-06T00:00:00Z

Content type: tutorial

Language: en

Sources: [Vasya Drobushkov](<https://devfeed.tech/sources/vasya-drobushkov.md>)

Topics: [backpressure](<https://devfeed.tech/topics/backpressure.md>), [kotlin-flow](<https://devfeed.tech/topics/kotlin-flow.md>), [RxJava](<https://devfeed.tech/topics/rxjava.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [reactive](<https://devfeed.tech/topics/reactive.md>), [Reactive Streams](<https://devfeed.tech/topics/reactive-streams.md>)

Tags: [article](<https://devfeed.tech/tags/article.md>), [backpressure](<https://devfeed.tech/tags/backpressure.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-flow](<https://devfeed.tech/tags/kotlin-flow.md>), [reactive-streams](<https://devfeed.tech/tags/reactive-streams.md>), [rxjava](<https://devfeed.tech/tags/rxjava.md>)

### AI overview

This article compares backpressure in RxJava and Kotlin Flow from a black-box perspective. It explains how RxJava Flowable uses Subscriber requests to regulate event production and introduces Kotlin Flow's backpressure solutions for developers considering migration.

### Source excerpt

Disclaimer This article unfortunately is not that dive deep (because of complexity of internals of coroutines), but instead trying to compare RxJava and Kotlin Flow mostly as black box with trying to find out differences in behavior and how to migrate from RxJava with its backpressure solution to Kotlin Flow. Hopefully this article will give you direction on where to look at if you decide to migrate to Kotlin Flow.

## Operator fusion in RxJava 2

DevFeed: [Operator fusion in RxJava 2](<https://devfeed.tech/articles/operator-fusion-in-rxjava-2-38620.md>)

Original publisher: [Read original article](<https://krossovochkin.com/posts/2019_11_02_operator_fusion_in_rxjava_2/>)

Published: 2019-11-02T00:00:00Z

Content type: tutorial

Language: en

Sources: [Vasya Drobushkov](<https://devfeed.tech/sources/vasya-drobushkov.md>)

Topics: [RxJava](<https://devfeed.tech/topics/rxjava.md>), [Library](<https://devfeed.tech/topics/library.md>), [reactive](<https://devfeed.tech/topics/reactive.md>), [backpressure](<https://devfeed.tech/topics/backpressure.md>)

Tags: [2](<https://devfeed.tech/tags/2.md>), [article](<https://devfeed.tech/tags/article.md>), [backpressure](<https://devfeed.tech/tags/backpressure.md>), [flowable](<https://devfeed.tech/tags/flowable.md>), [memory](<https://devfeed.tech/tags/memory.md>), [overhead](<https://devfeed.tech/tags/overhead.md>), [performance](<https://devfeed.tech/tags/performance.md>), [reactive](<https://devfeed.tech/tags/reactive.md>), [rxjava](<https://devfeed.tech/tags/rxjava.md>), [technical](<https://devfeed.tech/tags/technical.md>)

### AI overview

This article explains operator fusion in RxJava 2 as an optimization intended to reduce performance and memory overhead. It first reviews Observable, Flowable, their related observer or subscriber types, and backpressure, then introduces the assembly and subscription stages of an Rx chain.

### Source excerpt

Introduction RxJava is a very powerful library, though it has some issues as well. Specifically performance and memory issues, which come from problems library tries to solve and how the solution is designed from technical perspective. In order to minimize overhead in RxJava there are a number of optimizations, which are called "operator fusion". And we'll talk about them in this article. But first let's recap how RxJava reactive types work and what issues they have.

## Flowing in the Deep - Event Streams in Kotlin

DevFeed: [Flowing in the Deep - Event Streams in Kotlin](<https://devfeed.tech/articles/flowing-in-the-deep-event-streams-in-kotlin-25478.md>)

Original publisher: [Read original article](<https://hannesdorfmann.com/presentations/2019-07-02-flowing-in-the-deep/>)

Author: Hannes Dorfmann

Published: 2019-07-02T00:00:00Z

Content type: tutorial

Language: en

Sources: [Hannes Dorfmann](<https://devfeed.tech/sources/hannes-dorfmann.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [RxJava](<https://devfeed.tech/topics/rxjava.md>), [Streams](<https://devfeed.tech/topics/streams.md>), [Android](<https://devfeed.tech/topics/android.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [backpressure](<https://devfeed.tech/tags/backpressure.md>), [coroutine](<https://devfeed.tech/tags/coroutine.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [deep-dive](<https://devfeed.tech/tags/deep-dive.md>), [event](<https://devfeed.tech/tags/event.md>), [flow](<https://devfeed.tech/tags/flow.md>), [flowable](<https://devfeed.tech/tags/flowable.md>), [introduction](<https://devfeed.tech/tags/introduction.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [presentation](<https://devfeed.tech/tags/presentation.md>), [rxjava](<https://devfeed.tech/tags/rxjava.md>), [scopes](<https://devfeed.tech/tags/scopes.md>), [streams](<https://devfeed.tech/tags/streams.md>), [video](<https://devfeed.tech/tags/video.md>)

### AI overview

This presentation introduces Kotlin Flow, compares it with RxJava Observable and Flowable, and explains its relationship to coroutines. It also covers implementation details, custom operators, coroutine channels, backpressure, and coroutine scopes for use in Android apps.

### Source excerpt

The Kotlin team introduced a new type called Flow which looks similar to RxJava's Observable or Flowable. Have you ever wondered what's the difference between Flow and RxJava? How does Flow work under the hood? How is it connected to Coroutines? How do you write your own operator? What about Kotlin Coroutine Channels?

## Java 9 Flow API: Multicasting via a Processor

DevFeed: [Java 9 Flow API: Multicasting via a Processor](<https://devfeed.tech/articles/java-9-flow-api-multicasting-via-a-processor-24818.md>)

Original publisher: [Read original article](<https://akarnokd.blogspot.com/2017/12/java-9-flow-api-multicasting-via.html>)

Author: David Karnok (noreply@blogger.com)

Published: 2017-12-14T13:20:00Z

Content type: tutorial

Language: en

Sources: [Akarnokd - Advanced RxJava](<https://devfeed.tech/sources/akarnokd-advanced-rxjava.md>)

Topics: [Java](<https://devfeed.tech/topics/java.md>), [Java 9](<https://devfeed.tech/topics/java-9.md>), [reactive](<https://devfeed.tech/topics/reactive.md>), [Streams](<https://devfeed.tech/topics/streams.md>), [implementation](<https://devfeed.tech/topics/implementation.md>), [API](<https://devfeed.tech/topics/api.md>)

Tags: [backpressure](<https://devfeed.tech/tags/backpressure.md>), [cancellation](<https://devfeed.tech/tags/cancellation.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [flow](<https://devfeed.tech/tags/flow.md>), [flow-api](<https://devfeed.tech/tags/flow-api.md>), [java](<https://devfeed.tech/tags/java.md>), [java-9](<https://devfeed.tech/tags/java-9.md>), [jdk](<https://devfeed.tech/tags/jdk.md>), [multicast](<https://devfeed.tech/tags/multicast.md>), [processor](<https://devfeed.tech/tags/processor.md>), [reactive](<https://devfeed.tech/tags/reactive.md>), [reactive-streams](<https://devfeed.tech/tags/reactive-streams.md>), [streams](<https://devfeed.tech/tags/streams.md>), [subscriber](<https://devfeed.tech/tags/subscriber.md>), [subscription](<https://devfeed.tech/tags/subscription.md>), [tck](<https://devfeed.tech/tags/tck.md>)

### AI overview

This tutorial explains how Java 9 Flow API processors can multicast elements from a single upstream source to multiple consumers. It focuses on coordinating subscriber demand, backpressure, dynamic subscription, and cancellation, and introduces MulticastProcessor as the intermediate solution.

### Source excerpt

Introduction There are situations when the same elements of a source should be dispatched to multiple consumers. Certainly, if the source supports multiple subscribers and is deterministic (such as our previous async range), one can just instantiate the flow multiple times. However, if the source doesn't support multiple subscribers or each subscription ends up being unique and/or non-deterministic, that simple approach doesn't work anymore. We need a way to have a single realization of the (upstream) source yet allow multiple consumers. Since we are dealing with Flow.Publishers that require backpressure management, such intermediate solution has to coordinate requests from its Flow.Subscribers in addition to handling the dynamic subscription and unsubscription (cancellation) of said Flow.Subscribers while the flow is active. Enter, MulticastProcessor. Flow.Processor recap What is a Processor? By definition, it is a combination of a Flow.Publisher and a Flow.Subscriber, i.e., it can act as a source and can be subscribed to via subscribe() as well as the processor itself can be used with somebody else's Flow.Publisher.subscribe(). It has a mixed history as the idea comes from the original Observer pattern (i.e., java.util.Observable) and Rx.NET's Subject that allows dispatching signals to multiple Observers in an imperative (and synchronous) fashion. The Flow.Processor in Java 9 defines two type arguments, one for its input side (Flow.Subscriber) and one for its output side (Flow.Publisher). The idea behind it was that a Flow.Processor can act as a transformation step between an upstream and a downstream. However, such transformation often mandates the Flow.Processor implementation only accepts a single Flow.Subscriber during its entire lifetime. Since the implementation has to follow the Reactive Streams specification nonetheless, this adds a lot of overhead to the flow. As demonstrated in previous posts, when a flow is realized, there are only one subscriber per st

## Android LiveData API: a quick look

DevFeed: [Android LiveData API: a quick look](<https://devfeed.tech/articles/android-livedata-api-a-quick-look-24816.md>)

Original publisher: [Read original article](<https://akarnokd.blogspot.com/2017/10/android-livedata-api-quick-look.html>)

Author: David Karnok (noreply@blogger.com)

Published: 2017-10-19T13:45:00Z

Content type: tutorial

Language: en

Sources: [Akarnokd - Advanced RxJava](<https://devfeed.tech/sources/akarnokd-advanced-rxjava.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [API](<https://devfeed.tech/topics/api.md>), [reactive](<https://devfeed.tech/topics/reactive.md>), [Library](<https://devfeed.tech/topics/library.md>), [Streams](<https://devfeed.tech/topics/streams.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [api](<https://devfeed.tech/tags/api.md>), [backpressure](<https://devfeed.tech/tags/backpressure.md>), [cancellation](<https://devfeed.tech/tags/cancellation.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [flow](<https://devfeed.tech/tags/flow.md>), [flowable](<https://devfeed.tech/tags/flowable.md>), [google](<https://devfeed.tech/tags/google.md>), [lifecycle](<https://devfeed.tech/tags/lifecycle.md>), [lifecycle-components](<https://devfeed.tech/tags/lifecycle-components.md>), [livedata](<https://devfeed.tech/tags/livedata.md>), [reactive](<https://devfeed.tech/tags/reactive.md>), [release](<https://devfeed.tech/tags/release.md>), [rxjava](<https://devfeed.tech/tags/rxjava.md>), [subscription](<https://devfeed.tech/tags/subscription.md>), [thread](<https://devfeed.tech/tags/thread.md>), [threading](<https://devfeed.tech/tags/threading.md>), [ui](<https://devfeed.tech/tags/ui.md>)

### AI overview

This article provides a quick technical overview of Android LiveData, explaining its main-thread requirements, lifecycle-aware observer behavior, observer removal, and interoperability with Reactive Streams. It notes that LiveData was considered beta and could change before release.

### Source excerpt

Introduction Threading and lifecycle are one of the top concerns when developing applications for the Android platform. UI has to be interacted with on a dedicated thread (main thread) but in order to keep the UI responsible to user input and rendering, blocking or CPU intensive calculations should be kept off it. In addition, views can get destroyed and recreated in a way that is outside of a given application's control unlike a desktop Swing application. This means background tasks must be stopped and listeners removed to prevent leaking references to now logically dead objects. RxJava and RxAndroid can help with threading concerns and there are other libraries that tap into the various lifecycle events; in general, this means someone will call dispose() on a particular flow or clear() on a CompositeDisposable to mass-cancel multiples of them. Having a rich set of transformative and coordinating operators along with support for normal values, errors and finite sequences may be overwhelming compared to a classical Listener-based API. Google's LiveData is one of such classical Listener style APIs but unlike Swing's ActionListener for example, there are explicit requirements that interaction with the LiveData object itself happens on the main thread and signals will be dispatched from the main thread to Observers to it. LiveData API Unfortunately, I wasn't able to locate a public repository for the LiveData sources and had to rely on the sources downloaded from Google's Maven repository: compile "android.arch.lifecycle:reactivestreams:1+" There is an interoperation library associated with LiveData that allows presenting and consuming events from any Reactive-Streams Publisher. This will transitively import the actual LiveData library. Note that LiveData is currently considered beta and may change arbitrarily before release. That said, I don't think the core structure and premise will actually change. The main consumer type is the android.arch.lifecycle.Observer with

## Interoperation between RxJava and Kotlin Coroutines

DevFeed: [Interoperation between RxJava and Kotlin Coroutines](<https://devfeed.tech/articles/interoperation-between-rxjava-and-kotlin-coroutines-24806.md>)

Original publisher: [Read original article](<https://akarnokd.blogspot.com/2017/09/interoperation-between-rxjava-and.html>)

Author: David Karnok (noreply@blogger.com)

Published: 2017-09-11T21:29:00Z

Content type: tutorial

Language: en

Sources: [Akarnokd - Advanced RxJava](<https://devfeed.tech/sources/akarnokd-advanced-rxjava.md>)

Topics: [kotlin-coroutines](<https://devfeed.tech/topics/kotlin-coroutines.md>), [Coroutines](<https://devfeed.tech/topics/coroutines.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Code](<https://devfeed.tech/topics/code.md>), [Compiler](<https://devfeed.tech/topics/compiler.md>)

Tags: [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [await](<https://devfeed.tech/tags/await.md>), [backpressure](<https://devfeed.tech/tags/backpressure.md>), [channel](<https://devfeed.tech/tags/channel.md>), [code](<https://devfeed.tech/tags/code.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [coroutines](<https://devfeed.tech/tags/coroutines.md>), [flow](<https://devfeed.tech/tags/flow.md>), [flowable](<https://devfeed.tech/tags/flowable.md>), [flowablesubscriber](<https://devfeed.tech/tags/flowablesubscriber.md>), [interoperation](<https://devfeed.tech/tags/interoperation.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-coroutines](<https://devfeed.tech/tags/kotlin-coroutines.md>), [notify](<https://devfeed.tech/tags/notify.md>), [rxjava](<https://devfeed.tech/tags/rxjava.md>), [stream](<https://devfeed.tech/tags/stream.md>), [subscription](<https://devfeed.tech/tags/subscription.md>), [suspend](<https://devfeed.tech/tags/suspend.md>)

### AI overview

This tutorial explains how to make RxJava work with Kotlin Coroutines. It introduces a suspendable emitter and a coroutine-based Flowable generator that can suspend emission until downstream demand is available.

### Source excerpt

Introduction Writing imperative-looking code with Kotlin Coroutines is certainly an attractive property of it, but I'd think things can get quite convoluted pretty fast once, for example, Selectors are involved. I haven't gotten there to look at what Selectors are, I only read that they can help you implement a flatMap like stream combiner. We are not goind to do that now, RxJava can do it for us after all. However, the reasonable question arises: if I have a coroutine generator, a coroutine transformation or simply want to receive items from a Flowable, how can I make RxJava work with these coroutines? Easily with the combined magic of Kotlin Coroutines and RxJava coroutines! Suspendable Emitter A generator is a source-like construct that emits items followed by a terminal signal. It should be familiar from RxJava as the Flowable.generate() operator. It gives you a FlowableEmitter and the usual onNext, onError and onComplete calls on it. One limitation is that you can call onNext only once per invocation of your (Bi)Consumer lambda that receives the emitter. The reason is that we can't block a second call to onNext and we don't want to buffer it either; therefore, RxJava cooperates with the developer. Compiler supported suspension and state machine built by it, however, allow us to prevent a second call from getting through by suspending it until there is a demand from the downstream, which then resumes the coroutine where it left off. Therefore, we can lift the single onNext requirement for our Coroutine-based generator. So let's define the SuspendEmitter interface interface SuspendEmitter<in T> : CoroutineScope { suspend fun onNext(t: T) suspend fun onError(t: Throwable) suspend fun onComplete() } By extending the CoroutineScope, we provide useful infrastructure (i.e., coroutineContext, isActive) to the block that will target our SuspendEmitter. One can argue that why use onError and onComplete since a coroutine can throw and simply end. The reason is that this w

## Java 9 Flow API: ordered merge

DevFeed: [Java 9 Flow API: ordered merge](<https://devfeed.tech/articles/java-9-flow-api-ordered-merge-24810.md>)

Original publisher: [Read original article](<https://akarnokd.blogspot.com/2017/09/java-9-flow-api-ordered-merge.html>)

Author: David Karnok (noreply@blogger.com)

Published: 2017-09-11T14:46:00Z

Content type: tutorial

Language: en

Sources: [Akarnokd - Advanced RxJava](<https://devfeed.tech/sources/akarnokd-advanced-rxjava.md>)

Topics: [Java](<https://devfeed.tech/topics/java.md>), [Java 9](<https://devfeed.tech/topics/java-9.md>), [API](<https://devfeed.tech/topics/api.md>)

Tags: [backpressure](<https://devfeed.tech/tags/backpressure.md>), [batching](<https://devfeed.tech/tags/batching.md>), [flow](<https://devfeed.tech/tags/flow.md>), [flow-api](<https://devfeed.tech/tags/flow-api.md>), [java](<https://devfeed.tech/tags/java.md>), [java-9](<https://devfeed.tech/tags/java-9.md>), [merge](<https://devfeed.tech/tags/merge.md>), [ordered-merge](<https://devfeed.tech/tags/ordered-merge.md>), [queue](<https://devfeed.tech/tags/queue.md>), [reactive](<https://devfeed.tech/tags/reactive.md>), [rxjava](<https://devfeed.tech/tags/rxjava.md>), [sequences](<https://devfeed.tech/tags/sequences.md>), [stream](<https://devfeed.tech/tags/stream.md>)

### AI overview

This article explains why zip() and flatMap() are unsuitable for merging multiple ordered event sequences while preserving order. It presents an orderedMerge() operator that selects the smallest or largest available item, requires a fixed number of source sequences, and discusses how unordered sources produce priority-queue-like output. It also introduces prefetching, queues, coordination, batching, and stable-prefetch backpressure for an inner consumer implementation.

### Source excerpt

Introduction Sometimes, one has several ordered sequences of events and would like to merge them into one single flow. Since one element from a sequence should come before another element in another sequence, we need a way to keep comparing elements with each other from different sequences. Unfortunately, zip() doesn't work because it takes a row of available items and item #2 from sequence #2 may come before item #1 from stream #3. Plus, if one stream is shorter than the others, the end sequence stops. Similarly, flatMap() doesn't work because it takes the next item from any inner source sequence the moment it is available without any ordering considerations at that point. At least it emits all items from all sources (provided there are no errors of course). Therefore, we need something between the two operators: one that collects up a row of items from the sources, decides which is the smallest/largest of them based on some comparison logic and only emits that. It then awaits a fresh item from that specific source (or completion) and repeats the picking of the smallest/largest item as long as there are requests for it. Such operator, let's call it orderedMerge(), has an implication about the number of its inner source sequences: it has to be fixed. The reason for it is that it has to pick the smallest/largest of the available items in order for the output to be in order. If there is still a source missing, it can't know for sure the others are smaller/larger that any of the upcoming item from that missing source will produce. The second implication is, what happens if the sources themselves are not ordered? The logic presented in this post still works, but the end output won't be totally ordered. It will act like some priority queue instead: picking important items first before turning to less important ones. The inner consumer Operators handling multiple sources often need a way to prefetch item from these sources and give out them on demand to some joining logic

## Java 9 Flow API: mapping and filtering in one stage

DevFeed: [Java 9 Flow API: mapping and filtering in one stage](<https://devfeed.tech/articles/java-9-flow-api-mapping-and-filtering-in-one-stage-24808.md>)

Original publisher: [Read original article](<https://akarnokd.blogspot.com/2017/09/java-9-flow-api-mapping-and-filtering.html>)

Author: David Karnok (noreply@blogger.com)

Published: 2017-09-02T14:33:00Z

Content type: tutorial

Language: en

Sources: [Akarnokd - Advanced RxJava](<https://devfeed.tech/sources/akarnokd-advanced-rxjava.md>)

Topics: [Java 9](<https://devfeed.tech/topics/java-9.md>), [reactive](<https://devfeed.tech/topics/reactive.md>), [API](<https://devfeed.tech/topics/api.md>), [Library](<https://devfeed.tech/topics/library.md>), [Open Source](<https://devfeed.tech/topics/open-source.md>)

Tags: [backpressure](<https://devfeed.tech/tags/backpressure.md>), [exception](<https://devfeed.tech/tags/exception.md>), [flow](<https://devfeed.tech/tags/flow.md>), [flow-api](<https://devfeed.tech/tags/flow-api.md>), [java-9](<https://devfeed.tech/tags/java-9.md>), [publisher](<https://devfeed.tech/tags/publisher.md>), [reactive](<https://devfeed.tech/tags/reactive.md>), [reactive-streams](<https://devfeed.tech/tags/reactive-streams.md>), [rxjava](<https://devfeed.tech/tags/rxjava.md>), [subscriber](<https://devfeed.tech/tags/subscriber.md>)

### AI overview

This article examines how to combine mapping and filtering into a single custom operator for Java 9 Flow API publishers. It discusses API design choices, handling mapped, dropped, failed, and completed items, and preserving Reactive Streams backpressure and protocol requirements.

### Source excerpt

Introduction In most reactive libraries, mapping and filtering can be done on a flow via separate operators map() and filter() respectively. One rare occasions, the functions to these operators would need to communicate with each other without sharing information in a flow-external manner and without using defer(). Such combined and standard mapFilter() operator doesn't exist and one has to write one of its own. Given that the Java 9 Flow API is brand new, one has to definitely write a custom operator for it as Java 9 itself doesn't provide any rich set of predefined operations on Flow.Publishers unlike its dual, the Stream API. Shameless advertising By the way, if you are looking for a Java 9 Flow-based, native and modern reactive library with rich set of operators, similar to RxJava 2 (even including some operators from its extension project), I happen to have one for you: Reactive4JavaFlow. It is free and open-source with the promising outlook that one day, it may form the basis for the next major RxJava version... MapFilter API design When the Reactive4Java library was first concieved in 2011, the first significant stumbling block was not the lack of lambdas in Java 6/7 but the lack of extension methods. C# had it and made Rx.NET conveniently extendable (assuming you managed to understand how to write operators for it as it wasn't open source at the time). Java still doesn't have any sign of ever getting extension methods, therefore, we either need a rich abstract base class, such as Flowable or Flux, or an utility class whose methods almost look like extension method definitions with the exception that the developer has to stack them on top of one another: import java.util.concurrent.*; import static FlowUtils.*; Flow.Publisher<String> f = timeout( mapFilter( new FlowRange(1, 10, Runnable::run), (v, e) -> { if (v % 2 == 0) { e.next(v.toString()) } if (v == 7) { e.complete(); } } ), 5, TimeUnit.MILLISECONDS ); When thinking about a combined map and filter operat

## Java 9 Flow API: asynchronous integer range source

DevFeed: [Java 9 Flow API: asynchronous integer range source](<https://devfeed.tech/articles/java-9-flow-api-asynchronous-integer-range-source-24805.md>)

Original publisher: [Read original article](<https://akarnokd.blogspot.com/2017/03/java-9-flow-api-asynchronous-integer.html>)

Author: David Karnok (noreply@blogger.com)

Published: 2017-03-05T13:08:00Z

Content type: tutorial

Language: en

Sources: [Akarnokd - Advanced RxJava](<https://devfeed.tech/sources/akarnokd-advanced-rxjava.md>)

Topics: [Java](<https://devfeed.tech/topics/java.md>), [Java 9](<https://devfeed.tech/topics/java-9.md>), [reactive](<https://devfeed.tech/topics/reactive.md>), [interfaces](<https://devfeed.tech/topics/interfaces.md>), [IntelliJ IDEA](<https://devfeed.tech/topics/intellij-idea.md>)

Tags: [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [backpressure](<https://devfeed.tech/tags/backpressure.md>), [coroutine](<https://devfeed.tech/tags/coroutine.md>), [flow](<https://devfeed.tech/tags/flow.md>), [flow-api](<https://devfeed.tech/tags/flow-api.md>), [java](<https://devfeed.tech/tags/java.md>), [java-9](<https://devfeed.tech/tags/java-9.md>), [jdk](<https://devfeed.tech/tags/jdk.md>), [operator](<https://devfeed.tech/tags/operator.md>), [publisher](<https://devfeed.tech/tags/publisher.md>), [range](<https://devfeed.tech/tags/range.md>), [reactive](<https://devfeed.tech/tags/reactive.md>), [reactive-streams](<https://devfeed.tech/tags/reactive-streams.md>), [request-management](<https://devfeed.tech/tags/request-management.md>), [source](<https://devfeed.tech/tags/source.md>), [submissionpublisher](<https://devfeed.tech/tags/submissionpublisher.md>), [subscriber](<https://devfeed.tech/tags/subscriber.md>), [subscription](<https://devfeed.tech/tags/subscription.md>), [trampoline](<https://devfeed.tech/tags/trampoline.md>), [varhandle](<https://devfeed.tech/tags/varhandle.md>)

### AI overview

A tutorial explores Java 9's Flow API and Reactive Streams interfaces by building an asynchronous integer range Publisher. It discusses composing Publishers, implementing Flow.Subscription, handling subscriber demand, and using IntelliJ 2017.1 EAP while the APIs were non-final.

### Source excerpt

Introduction Java 9 is becoming more reactive by introducing the Reactive-Streams interfaces under the parent class java.util.concurrent.Flow, enabling a new standard interoperation between future libraries built on top. There is almost no documentation beyond a underwhelming Oracle documentation and the SubmissionPublisher class' JavaDoc about how to write Publishers, Subscriptions and Subscribers under the Flow API. Plus the Oracle document practically concludes with see RxJava. Indeed, replacing the imports of org.reactivestreams.* with java.util.concurrent.Flow.* in RxJava 2's sources get's one a fully fledged reactive library but there seems to be one crucial expectation with components built on the Flow API: they have to be asynchronous at every stage. I could argue that the underlying concepts work totally fine in synchronous mode, but who am I to question the established definitions? Oh well, if the constraint is to be asynchronous, then let's do it in an asynchronous way. To see what it takes, we could start with a relatively simple source: an asynchronous integer range. Since both Java 9 and the IDE support is in non-final state, I recommend IntelliJ 2017.1 EAP for this "exercise". Asynchronous integer range source Unfortunately, Java 9 won't introduce any standard fluent API entry point with all the well loved map(), filter(), flatMap() etc. operators but one has to build individual Publishers and compose them stage-by-stage. This involves creating a parent Publisher class with the following typical pattern to host the input parameters of the flow to be observed: import java.util.concurrent.*; public final class FlowRange implements Flow.Publisher<Integer> { final int start; final int end; final Executor executor; public FlowRange(int start, int count, Executor executor) { this.start = start; this.end = start + count; this.executor = executor; } @Override public void subscribe(Flow.Subscriber<? super Integer> subscriber) { // TODO implement } } For brevit

## Async Iterable/Enumerable vs. Reactive-Streams

DevFeed: [Async Iterable/Enumerable vs. Reactive-Streams](<https://devfeed.tech/articles/async-iterable-enumerable-vs-reactive-streams-24803.md>)

Original publisher: [Read original article](<https://akarnokd.blogspot.com/2016/05/async-iterableenumerable-vs-reactive.html>)

Author: David Karnok (noreply@blogger.com)

Published: 2016-05-02T13:54:00Z

Content type: comparison

Language: en

Sources: [Akarnokd - Advanced RxJava](<https://devfeed.tech/sources/akarnokd-advanced-rxjava.md>)

Topics: [reactive](<https://devfeed.tech/topics/reactive.md>), [Java](<https://devfeed.tech/topics/java.md>), [Promise](<https://devfeed.tech/topics/promise.md>), [interfaces](<https://devfeed.tech/topics/interfaces.md>), [Library](<https://devfeed.tech/topics/library.md>), [implementation](<https://devfeed.tech/topics/implementation.md>)

Tags: [async](<https://devfeed.tech/tags/async.md>), [backpressure](<https://devfeed.tech/tags/backpressure.md>), [interface](<https://devfeed.tech/tags/interface.md>), [java](<https://devfeed.tech/tags/java.md>), [library](<https://devfeed.tech/tags/library.md>), [reactive-streams](<https://devfeed.tech/tags/reactive-streams.md>)

### AI overview

This article compares Java Async Iterables, also called Async Enumerables in C#, with RxJava and Reactive Streams. It explains how asynchronous MoveNext operations provide backpressure and describes a Java 8 implementation using IAsyncEnumerable, IAsyncEnumerator, CompletionStage, and cancellation support.

### Source excerpt

Introduction Backpressure is essential if one wants to avoid buffer bloat and excessive memory usage if two stages in a reactive pipeline consume events with different speed. RxJava and Reactive-Streams developed a non-blocking, request-coordinating protocol to solve this problem, but you may have heard there are alternatives to it. One alternative that comes up from time to time is Async Iterables (Java terminology) or Async Enumerables (C# terminology). In fact Rx.NET has an Ix.NET (stands for Interactive Extensions) sub-project in which there is the Async Enumerables library. It solves this backpressure problem by having a Task (~ CompletableFuture, ~ Promise) returned from its MoveNext() (~ hasNext()) method and when that Task fires, you can consume the Current property (~ next() method). The backpressure behavior comes from the fact that you'd call MoveNext() again only after you processed the the current element. Unfortunately, I haven't found a Java implementation for the IAsyncEnumerable (haven't really looked beyond a few Google searches), so I decided I'll implement it on my own in Java 8, see what it takes to get data across with it and how performant is it compared to my current cutting-edge understanding of reactive-flows: the Reactive-Streams-Commons library. Base API Since Async Enumerables are designed in deferred execution in mind, the base API consists of two interfaces: interface IAsyncEnumerable<T> { IAsyncEnumerator<T> enumerator(); } interface IAsyncEnumerator<T> { CompletionStage<Boolean> moveNext(CompositeSubscription cancel); T current(); } The IAsyncEnumerable is the equivalent of Iterable and it hands out IAsyncEnumerators. IAsyncEnumerator has a moveNext method which returns a CompletionStage indicating if there is value available via current() (signals true) or the sequence ended (signals false). C# CancellationToken looks like our CompositeSubscription so I'm reusing it as the way for cancellation. (Sidenote: I'm not sure how cancellati

## SubscribeOn and ObserveOn

DevFeed: [SubscribeOn and ObserveOn](<https://devfeed.tech/articles/subscribeon-and-observeon-24799.md>)

Original publisher: [Read original article](<https://akarnokd.blogspot.com/2016/03/subscribeon-and-observeon.html>)

Author: David Karnok (noreply@blogger.com)

Published: 2016-03-31T12:55:00Z

Content type: tutorial

Language: en

Sources: [Akarnokd - Advanced RxJava](<https://devfeed.tech/sources/akarnokd-advanced-rxjava.md>)

Topics: [Programming](<https://devfeed.tech/topics/programming.md>), [reactive](<https://devfeed.tech/topics/reactive.md>), [User Experience](<https://devfeed.tech/topics/user-experience.md>), [Android](<https://devfeed.tech/topics/android.md>), [GUI](<https://devfeed.tech/topics/gui.md>)

Tags: [backpressure](<https://devfeed.tech/tags/backpressure.md>), [blocking](<https://devfeed.tech/tags/blocking.md>), [cancellation](<https://devfeed.tech/tags/cancellation.md>), [executorservice](<https://devfeed.tech/tags/executorservice.md>), [main-thread](<https://devfeed.tech/tags/main-thread.md>), [observeon](<https://devfeed.tech/tags/observeon.md>), [reactive](<https://devfeed.tech/tags/reactive.md>), [rxjava](<https://devfeed.tech/tags/rxjava.md>), [subscribeon](<https://devfeed.tech/tags/subscribeon.md>), [thread](<https://devfeed.tech/tags/thread.md>)

### AI overview

A tutorial explaining why RxJava's subscribeOn and observeOn operators are often confused. It distinguishes their effects by tracing subscription and method-call flow, and discusses moving subscription side effects such as network, database, or blocking work away from the current thread.

### Source excerpt

Introduction One of the most confused operator pair of the reactive ecosystem is the subscribeOn and observeOn operators. The source of confusion may be rooted in a few causes: they sound alike, they sometimes show similar behavior when looked at from downstream and they are duals in some sense. It appears the name-confusion isn't local to RxJava. Project Reactor faces a similar issue with their publishOn and dispatchOn operators. Apparently, it doesn't matter what they are called and people will confuse them anyhow. When I started learning about Rx.NET back in 2010, I never experienced this confusion; subscribeOn affects subscribe() and observeOn affects onXXX(). (Remark: I've searched Channel 9 for the early videos but couldn't really find the talk where they build up these operators just like I'm about to do. The closest thing was this.) My "thesis" is that the confusion may be resolved by walking through how one can implement these operators and thus showing the internal method-call flow. SubscribeOn The purpose of subscribeOn() is to make sure side-effects from calling subscribe() happens on some other thread. However, almost no standard RxJava source does side-effects on its own; you can have side-effects with custom Observables, wrapped subscription-actions via create() or as of lately, the with the SyncOnSubscribe and fromCallable() APIs. Why would one move the side-effects? The main use cases are doing network calls or database access on the current thread or anything that involves blocking wait. Holding off a Tomcat worker thread hasn't been much of a programming problem (that doesn't mean we can't improve the stack with reactive) but holding off the Event Dispatch Thread in a Swing application or the Main thread in an Android application has adverse effect on the user experience. (Sidenote: it's a funny thing that blocking the EDT is basically a convenience backpressure strategy in the GUI world to prevent the user from changing the application state whil

[Next page](<https://devfeed.tech/tags/backpressure.md?cursor=WyIyMDE2LTAzLTMxVDEyOjU1OjAwKzAwOjAwIiwgIjc4M2NiODJlLTg0ZWMtNDU5Ny1iMDQ0LTRiZTQyMWNlMDgxZSJd>)