https://gist.github.com/timcharper/235f73af5b36e3157c9c using AckedStream instead
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// RabbitSource in op-rabbit v1.0.0-M9 returns an AckedSource | |
val source = RabbitSource( | |
"Worker", | |
rabbitMq, | |
channel(qos = 100), | |
consume(topic("app.domain.class", topics = List(Pg.Table("MainTable").all, Pg.Table("RelatedTable").all))), | |
body(as[PgChange]).map(getPrimaryId)) | |
source. | |
collect { case Some(i) => i }. | |
groupedWithin(100, 60 seconds). | |
mapConcat { _.distinct }. | |
mapAsync(4) { primaryId => | |
api.pushChangesFor(primaryId) | |
}. | |
runAck |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment