Agent send operations inside a transaction get queued up and don't actually get sent until the transaction commits, that's probably what you want, it's meant for side-effects.
On Tue, Jun 17, 2014 at 5:43 PM, Hussein B. <hubaghd...@gmail.com> wrote: > Hi, > > I have a ServerSocket that stores the client ID and the client socket > object into a ref type. And I also have a thread that is running in the > background that checks if a specific condition is met, then it will start > send notifications to the clients (it will use the client-id-ref and > messages-ref). > > Of course, since both are refs; any operation needs to be run under a STM > transaction. > > My question is, is it ok to do IO Socket operation inside a STM > transaction? STM transaction might retry, this means that there are great > chances that the clients will receive the notifications more than once. > > For Socket IO operations inside STM transaction, is better/recommended to > do it using Agents? Since, AFAIK, agents inside a transaction will be > executed only if the transaction is successful. > > Thanks. > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.