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

https://github.com/daggerok/functional-streaming

4del: This is going to be removed... or refactored if not so useless as I'm currently thinking... spring-cloud-stream, spring-cloud-reactive-streams, kafka, docker, gradle composed builds, streaming using reactor Mono/Flux
https://github.com/daggerok/functional-streaming

Last synced: 9 months ago
JSON representation

4del: This is going to be removed... or refactored if not so useless as I'm currently thinking... spring-cloud-stream, spring-cloud-reactive-streams, kafka, docker, gradle composed builds, streaming using reactor Mono/Flux

Awesome Lists containing this project

README

          

= functional-streaming image:https://travis-ci.org/daggerok/functional-streaming.svg?branch=master["Build Status", link="https://travis-ci.org/daggerok/functional-streaming"]

see other repo:

- link:https://github.com/daggerok/spring-cloud-function-stream-integration[spring-cloud-function and spring-cloud-stream integration]

== functional streaming using spring cloud (reactive) streams, schema registry, avro

see https://github.com/daggerok/functional-streaming/tree/master/streaming-reactive-processor[streaming-reactive-processor] and https://github.com/daggerok/functional-streaming/tree/master/streaming-reactive-consumer[streaming-reactive-consumer] projects

in our messaging pipeline we can use Mono / Flux from reactor project, which makes developing streaming cloud native application more exciting!

[source,java]
----
@Output(Processor.OUTPU)
@StreamListener(Processor.INPUT)
public Flux> correctMessagesReceiver(final Flux> payload) {

return payload.map(Map::entrySet)
.map(Set::iterator)
.filter(Iterator::hasNext)
.map(Iterator::next)
.map(this::doSomeTransformationLogic)
.window(3) // pagination or could be also time interval collector
.flatMap(window -> window.reduce("|", (s1, s2) -> s1 + s2 + "|"))
.map(body -> MessageBuilder.withPayload(body).build());
}
----

right now is only one limitation: spring-cloud-stream doesn't suppotr spring-webflux yet, but I hope It will be changed soon (plus see streaming-reactive-*)

== build, run, clean

. bootstrap your message broker (docker-compose required)
. start apps
. cleanup

[source,bash]
----
gradle composeUp

gradle bootRun-producer
gradle bootRun-processor
gradle bootRun-aggregator
gradle bootRun-consumer
gradle bootRun-reactive-producer
gradle bootRun-reactive-aggregator
gradle bootRun-reactive-processor
gradle bootRun-reactive-consumer

gradle composeDown
gradle --stop
----

.run integration tests
[source,bash]
gradle integrationTests

other repositories:

. link:https://github.com/daggerok/serverless-examples[Serveless examples (spring-cloud-functions)]