-
Notifications
You must be signed in to change notification settings - Fork 144
Open
Description
We had some discussion yesterday on Discord about removing stopConsumption
See:
- Starting here: https://discord.com/channels/629491597070827530/629497941719121960/1120614848015900744
- "interruptor" idea: https://discord.com/channels/629491597070827530/629497941719121960/1120649014350708748
Found a new idea this morning while taking my shower 😄
I think we could "generalize" the "interruptor" idea.
We could return a "control" interface that'd have 3 methods:
- pause: would pause the stream
- resume: would resume the paused stream
- stop: would stop the stream and the subscription
// pseudo-code just to give show the idea
(
val (control, stream0) =
Consumer
.plainStream(Sub.topic("topic-a"), ...)
.mapZIO(processRecord0(_))
.runDrain
control.pause() // pauses stream0
control.resume() // resume stream0
control.stop() // stop/finalize stream0
).provide(ZLayer.scoped(Consumer.make(settings)))The "Control" interface would be something like:
trait Control {
def pause: IO[AlreadyStopped, Boolean] // Boolean as we probably want to give a feedback to the user
def resume: IO[AlreadyStopped, Boolean]
def stop: UIO[AlreadyStopped, Boolean]
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels