reactive-system icon indicating copy to clipboard operation
reactive-system copied to clipboard

Add Semantic At-Least-Once to Client

Open patricknoir opened this issue 8 years ago • 0 comments

The current implementation of the Reactive-System client has a Kafka Producer to read the response messages. It uses a strategy which commit the offset to Kafka immediately after the message is read.

We should also offer an implementation where through an API the user library get a Future[Committable[Out]].

i.e.:

val client = ReactiveClient.atLeastOnce(...)
val futureResult: Future[Committable[String]] = client.request("echoService")("kafka:echoTopic/echo", "hello world")

futureResult.map { cr: Committable[String] =>
  val result: String = cr.value
  cr.commit()
}

Note: I was tempted to make Committable composable but it isn't, only if the messages are coming from the same topic/partition they can compose, in all other scenarios there is no easy implementation. As conclusion do not attempt to make Committable a monad.

patricknoir avatar Mar 23 '17 04:03 patricknoir