core-async 2023-01-04

Hi. Is it possible to implement a custom channel type, e.g. something backed by a persistent queue? I can see some protocols, but they are under implementation details.

@hiredman I wasn’t clear in my question, you are right. I did mean an external job queue, like RabbitMQ or Redis. The Pub protocol looks interesting, but it looks like it will only let channels sub to the queue. What I’m looking for is a channel that sends messages put to it to an external queue, and provides values from the external queue on takes.

@alexmiller A custom buffer looks like it could be the way to go. Is it “safe” to implement the Buffer protocol under the clojure.core.async.impl.protocols ns?

Alex Miller (Clojure team) 2023-01-05T13:23:32.227239Z

That’s why it exists :)

👍 1

I usually consider things under impl namespaces as implementation details and subject to change, which is why I asked. 🙂

Alex Miller (Clojure team) 2023-01-04T18:43:12.364669Z

core.async goes through the protocols for ReadPort, WritePort etc so you can write a custom impl (but there are a lot of details in how channels are expected to work). maybe a custom buffer instead?

you might be better served by implementing the Pub protocol for your queue service, so you can sub channels to particular queues

sorry, I read persistent queue as some like an external job queue, if you mean clojure's persistent queue, I wouldn't bother