I've used agents to wrap thread-unsafe mutable Java objects with a defined life
cycle, so that they could be used from multiple threads whilst respecting the
My particular case was server-side gRPC StreamObservers for long lived client
These are either usable, closed, or errored and an exception is thrown if you
try to send on a closed or errored observer.
Using the agent state to model the life cycle, and the natural queueing of
agent actions gave me thread-safe fire-and-forget semantics (which was
appropriate for the messages involved).
To be honest it was the first time I've found a good use for agents, but they
fit really well.
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to firstname.lastname@example.org
Note that posts from new members are moderated - please be patient with your
To unsubscribe from this group, send email to
For more options, visit this group at
You received this message because you are subscribed to the Google Groups
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.