liveBook · Manning

Send-via

As explained in Clojure: The Essential Reference

send-via is a Clojure function that asynchronously dispatches an agent action using a specified executor.

send-via asynchronously dispatches an action to a Clojure agent using a specified executor, giving agent work an explicitly chosen execution facility. section 14.6

A small wrapper can place the executor first, then accept an agent, function, and arguments. The action remains asynchronous, so await or dereferencing observes its completed state. section 14.6

Dispatch through a work-stealing pool

Create a java.util.concurrent work-stealing pool, define send-fj around (apply send-via fj-pool a f args), send inc to an agent, await it, and observe the value 2.

How Clojure: The Essential Reference covers it

How deep it goes
Demonstrates a concise wrapper and working executor example without detailing executor internals or action scheduling semantics.
Examples
Uses a Java work-stealing pool, a send-fj wrapper, an increment action, await, and agent dereferencing.
What it assumes
Assumes familiarity with agents, asynchronous actions, await, dereferencing, and Java executor construction.
What you can do after
Apply it via java.util.concurrent.Executors to route an agent action through a chosen work-stealing pool.
How it connects
Connects agents with executors, send, send-off, await, and asynchronous sequential action processing.

This explainer was generated by Manning's knowledge graph from the text of Clojure: The Essential Reference. The section links point to the parts of the book it draws on.