core-async

Drew Verlee 2025-02-04T17:32:39.782919Z

Just watched Alex's talk on Flow, i have one quick question that i hope to get a light answer to: can someone give an example of when the start and stop functionality would be used? I'm not sure i understood why the thing being controlled would need this unless it was an external system like a db or another computer over the network. The question might be nonsense, I'm still wrapping my head around the ideas presented. Thanks!

2025-02-04T18:35:16.309659Z

Link? I haven't done a lot of stopping and starting of individual processes, but stopping flows is useful at dev time in the repl, when you need to redefine the flow

πŸ‘ 1
2025-02-04T18:37:07.568469Z

I've got a little project that (mis?)uses a flow as the sort of "init" system, sort of replacing something like component, and starting/stopping the flow become like starting and stopping the system

πŸ‘ 1
2025-02-04T19:06:48.170369Z

invariably some of the processes in a flow will be sources or sinks, of information external to the flow, and as such might have related resources that need to be created and cleaned up. So that outer edge of the lifecycle is for that. Also ensures that a created but not yet started flow is essentially information.

πŸ‘ 1
πŸ™ 1
2025-02-04T19:12:13.695739Z

there’s no API for start/stop process independent of the entire flow, just pause/resume which is an inner lifecycle around the interprocess flow

πŸ‘ 1
πŸ™ 1
2025-02-04T19:20:43.721879Z

flow q: I’m gathering use cases for multiple connections to the same output. Fundamental options are a) distribute - multiple connections compete to consume the outputs, or b) multiply - broadcast, as per core.async/mult If you have a use case I’m interested.

phronmophobic 2025-02-04T19:28:30.574759Z

My intended use case is using flows for processing audio/video streams. A common use case is to have a single input stream feed into multiple filters that get combined later:

/---- filter A ---\
video-stream --<                    >--- combine video streams side by side
                 \---- filter B ---/
For this use case, option b is convenient.

2025-02-04T20:30:42.672659Z

We've been using mult such that multiple listeners can subscribe to the same feed of data. In our particular case, orchestrating the sending of updates to multiple clients visiting the same page over web sockets. In this case, b would be nice. I would probably use a queue for use case a.

nwjsmith 2025-02-05T15:21:40.691309Z

I have a use-case for distributing work. The overall flow is taking asset pricing updates from a single stream, serializing them to Avro, and pushing them serialized to Kafka. We want the serialization part of this distributed across all cpu cores. But there's a wrinkle: pricing updates for the same asset must be processed in order. e.g we can parallelize serialization of (goog-123, aapl-123, goog-456, aapl-456) -> (goog-123, goog-456), (aapl-123, aapl-456).

2025-02-05T18:45:47.975959Z

I have around to A. B is the model I've had in my mind, but the majority of my process outs end up with a single consumer. I have one left with multiple consumers. If you want the racey consumption of A, I am not sure how else you could get it as things currently stand, but you can emulate B with a process that collects coords a distributes messages to them

2025-02-05T18:51:49.157149Z

(actually, given that flow topologies are static, you don't even need to track coords like that, just add a "fanout" process in the graph)

PaweΕ‚ 2025-02-09T14:10:32.361329Z

In an Event Sourcing/CQRS scenario, if a stream contains commands, A could be used to handle them, and if a stream contains events, B could be used to update multiple read-side databases.

2025-02-04T19:23:19.477119Z

option c) is disallow - roll your own distributing or multiplying procs