Skip to content

Instantly share code, notes, and snippets.

@damionjunk
Last active December 24, 2015 21:49
Show Gist options
  • Save damionjunk/6868383 to your computer and use it in GitHub Desktop.
Save damionjunk/6868383 to your computer and use it in GitHub Desktop.
(ns foo
(:require [immutant.messaging :as msg]))
(defonce magic (atom 0))
(defn foo-responder
"Return an incrementing magic number"
[_]
(swap! magic inc))
(defn baz-responder
"Requests the magic number from another queue."
[_]
{:magic @(msg/request "queue.foo" nil)})
(defn setup
""
[]
(msg/start "queue.foo")
(msg/start "queue.baz")
(msg/respond "queue.foo" foo-responder)
(msg/respond "queue.baz" baz-responder :xa false))
(comment
;; Start the queues
(setup)
@(msg/request "queue.foo" nil)
;; => 1
@(msg/request "queue.baz" nil)
;; hang - then timeout warnings
;; 09:49:58,448 WARN [com.arjuna.ats.arjuna] (Transaction Reaper) ARJUNA012117: TransactionReaper::check timeout for TX 0:ffffc0a80085:-765475f3:5252b67c:158 in state RUN
;; 09:49:58,449 WARN [com.arjuna.ats.arjuna] (Transaction Reaper Worker 0) ARJUNA012095: Abort of action id 0:ffffc0a80085:-765475f3:5252b67c:158 invoked while multiple threads active within it.
;; 09:49:58,449 WARN [com.arjuna.ats.arjuna] (Transaction Reaper Worker 0) ARJUNA012108: CheckedAction::check - atomic action 0:ffffc0a80085:-765475f3:5252b67c:158 aborting with 1 threads active!
;; 09:49:58,458 WARN [com.arjuna.ats.arjuna] (Transaction Reaper Worker 0) ARJUNA012121: TransactionReaper::doCancellations worker Thread[Transaction Reaper Worker 0,5,main] successfully canceled TX 0:ffffc0a80085:-765475f3:5252b67c:158
;; Adding :xa false to turn off transactions fixes ^^
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment