This is a long one.
My problem: I'm having trouble backpressureing a function that is currently using an old pub/sub device on one of its events (that is to say: I have a producer that is running too fast for my consumer). I'm using guava's EventBus
, which is old and very stateful. This works fine for many use cases, but in this particular backpressure case I've got deadlock for reasons I dont entirely understand if a subscriber calls runBlocking{}
to attempt to block ImportantService
when it fires a message.
EventBus
is effectively depricated; it's really convienient for UI (read: giant stateful objects) but it's awful for any service trying to maintain referential transparency (read: using pure functions and composing message processing with things like flow.map
)
At its core, I have this kind of object:
class ImportantService(..., private val eventPublisher: EventBus){