An open API service indexing awesome lists of open source software.

https://github.com/lbovet/streap

Stateful Stream Processing with Project Reactor
https://github.com/lbovet/streap

Last synced: 13 days ago
JSON representation

Stateful Stream Processing with Project Reactor

Awesome Lists containing this project

README

        

# Streap
[![Build Status](https://travis-ci.org/lbovet/streap.svg?branch=master)](https://travis-ci.org/lbovet/streap)

A swisspost project

Write streaming pipelines using blocks.

Blocks are units of work. They synchronize transactional contexts during the processing of streamed items.

orderReceiver
.receiveExactlyOnce(confirmationSender.transactionManager()))
.compose(createBlock(confirmationSender.transactionManager(),
PlatformTransactionBlock.supplier(transactionTemplate)))
.concatMap(b -> b.items()
.map(r -> r.value)
.flatMap(b.wrapOnce(storage::createOrder)) // don't run this again after a failure
.flatMap(order -> service.getArticleAvailabilities(order))
.flatMap(b.wrap(a -> storage.setAvailability(order, a)) // delegate this to be executed in the block
.compose(sendAvailability)
.all(a -> a.qty >= 0)
.filter(Boolean.TRUE::equals)
.compose(sendConfirmation)
.timeout(Duration.ofSeconds(30)))
.doOnComplete(b::commit)
.doOnError(b::abort))
.subscribe()

See [Reactor Kafka Exactly-Once Flow](https://projectreactor.io/docs/kafka/release/reference/#exactly-once)