title: clojure sendoff println function
body: <p>I am trying to <code>send-off</code> function <code>println</code> in the transaction.</p>
  
  <pre><code>(ns com.lapots.functional.clojure.transact
      (:gen-class))
  
  (defn transfer [from to amount]
      (alter
          (.balance from) - amount)
       (alter
          (.balance from) + amount))
  
  (defrecord Account [balance])
  
  (defn -main [&amp; args]
      (def account1 (Account. (ref 100)))
      (def account2 (Account. (ref 100)))
      (def trx-agent (agent 0))
  
      (future
          (dosync
              (send-off trx-agent println "T2 transfer")
              (Thread/sleep 5000)
              (transfer account1 account2 10)))
  
      (dosync
          (println "T1 transfer")
          (transfer account1 account2 10))
  
      (shutdown-agents)
  )
  </code></pre>
  
  <p>If I do like this</p>
  
  <pre><code>(println "T2 transfer")
  (Thread/sleep 5000)
  </code></pre>
  
  <p>it displays message twice as the transaction retries. So I decided to use <code>agents</code> to make side-effecting operation <code>println</code> run only once.</p>
  
  <p>But when I do like this</p>
  
  <pre><code>(send-off trx-agent println "T2 transfer")
  </code></pre>
  
  <p>It does not print <code>T2 transfer</code> message at all. What is the problem?</p>