
river
Introducing River, a powerful and flexible reactive stream library for Kotlin that simplifies the process of using and building connectors for multiple enterprise protocols and tools. Heavily inspired by Apache Camel and Alpakka, River makes use of Kotlin's Flow and coroutines to provide a scalable, efficient, and user-friendly way to handle asynchronous and event-based data streams. This library is designed to be flexible and customizable, allowing you to handle complex data streams and integrate with different technologies seamlessly.
Whether you're building a new application or integrating with existing systems, River makes it easy to build reactive and scalable data pipelines that can handle even the most demanding workloads. With its powerful capabilities and easy-to-use API, River allows you to focus on your business logic while it'll take care of the complex task of handling data streams and integrating with multiple technologies.
Disclaimer: This project is heavily under development, anything is subject to change until the first final release.
The core module
Kotlin's Flow API is a powerful and flexible tool for processing data streams, but it can sometimes require a lot of boilerplate code for certain tasks. That's where River-Kt's core module comes in. It provides a set of higher-level abstractions that make working with flows more intuitive and efficient.
At the heart of every connector, the core module offers a range of extension functions that can optimize the processing of data streams. By leveraging these high-level functions, developers can easily build connectors for different protocols. This allows for seamless integration with a variety of services and protocols.
The mapAsync is just an example of how the core module can simplify and speed up data processing by concurrently applying transformations to flow elements. Other functions such as split and chunked can also be used to break down large flows into smaller, more manageable chunks or groups, based on a count or time window strategy. Other useful functions are also provided, such as collecting data into lists, applying timeouts and delays, and continuously polling for data. All of these functions leverage Kotlin's Flow API, which ensures that data processing is done in an asynchronous, non-blocking, and backpressure-safe way.
Check the following example:
Are you a visual learner? The code basically represents the flow below:

To get to know the core module a bit further, you can refer to the site's kdoc or you can check the code directly.
To start using it, simply add the following dependencies:
implementation("com.river-kt:core:$latestVersion")
The connectors
Each connector leverages Kotlin's Flow API, coroutines and the core module to provide a simple and efficient way to interact with various protocols and services. You can check it out all the modules implemented currently.
To install a module, you can add the dependency as follows:
val connectorName = "connector-aws-sqs"
implementation("com.river-kt:$connectorName:$latestVersion")
Talking is cheap, show me the code!
Explore the Examples module and take a look at several of use cases for River. More examples are continually being added.
Contributing
Do you want to help us? Please, read our Contributing Guidelines. Don't forget to read our Code of conduct as well.
License
This project is licensed under the MIT License - see the LICENSE.md file for details