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
- Host: GitHub
- URL: https://github.com/lbovet/streap
- Owner: lbovet
- License: apache-2.0
- Created: 2018-12-23T18:16:21.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-08-18T12:35:30.000Z (over 1 year ago)
- Last Synced: 2025-04-15T21:48:17.550Z (13 days ago)
- Language: Java
- Size: 109 KB
- Stars: 6
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Streap
[](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)