Fork me on GitHub
#core-async
<
2019-09-16
>
jumar09:09:49

I'm still experimenting with core.async and trying to build a small system with it. I've never used in-process queues much before (when I used queues it was mostly for inter-process communication, e.g. RabbitMQ). What would you say are the benefits of using core.async channels vs. something like built-in JDK queue implementations? Is there anything in particular that stands out? On the other hand, something you miss? (I mentioned monitoring above, but maybe things like durability, etc.)

markmarkmark12:09:04

as far as I know the only real advantage that the channels have over the builtin queues is that the channels are integrated into core async.

markmarkmark12:09:41

some potentially interesting videos if you haven't seen them: https://www.youtube.com/watch?v=ROor6_NGIWU this is before core.async https://www.infoq.com/presentations/clojure-core-async/ this is talking about core.async

markmarkmark12:09:33

I don't remember which of those talks it is but I'm pretty sure in one of those talks, Rich Hickey says that the builtin java queues are great

markmarkmark12:09:00

I guess another advantage of channels is that they support transducers

gerred12:09:49

channels are also a more useful abstraction for "I want to block this thread while waiting to receive on this channel" when you're doing async work. some of the Go (language) channel talks by Rob Pike are relevant here as well, since the design and intent core.async is close to Go's goroutines and channels (though the underlying runtime and language are obviously very different)

gerred12:09:07

there's also built-in flow control for it. in Go this would be the select {} statement and in core.async this would be alts! or alts!!

gerred12:09:22

if you want to do flow control over popping multiple queues, you need to write that yourself.

gerred12:09:49

channels can also be used for synchronization between go blocks with blocking puts and blocking takes

markmarkmark13:09:59

ah, yeah alts is really nice