Clojure ratios are being converted to floating points when sent to and consumed from a JMS queue.
See this simple test code where the ratio 24/7 is converted to 3.428571428571429 when consumed.
(ns jms.test_jms
(:require [bowerick.jms :as j]))
(def url "tcp://127.0.0.1:61616")
(def destination "/topic/my.test.topic")
(def consumer (j/create-json-consumer
url
destination
(fn [data] (println "Received:" data))))
(def producer (j/create-json-producer url destination))
(producer "foo")
;;=> nil
;Received: foo
(producer '(1 7 0 1))
;;=> nil
;Received: (1 7 0 1)
(producer #{true false #inst"2008-05-10T00:00:00.000-00:00" 33.33M})
;;=> nil
;Received: (true false 2008-05-10T00:00:00Z 33.33)
;; Warning: Note that it does not handle ratios well converting it to floating point instead.
(producer 24/7)
;;=> nil
;Received: 3.428571428571429
(j/close producer)
;;Closing producer: tcp://127.0.0.1:61616 /topic/my.test.topic
(j/close consumer)
;;Closing consumer: tcp://127.0.0.1:61616 /topic/my.test.topic
Clojure ratios are being converted to floating points when sent to and consumed from a JMS queue.
See this simple test code where the ratio
24/7is converted to3.428571428571429when consumed.