New proletarian user here, liking it so far -- however my database is MariaDB rather than MySQL. It seems to me like UUIDs should be stored as type UUID or VARCHAR(36) in the database rather than BINARY(16)
In both cases, when trying to enqueue a job, I get the following exception, because at least in the rest of my code I've always converted the uuid to a string before saving to the db:
"Data truncation: Incorrect uuid value: '\\xAC\\xED\\x00\\x05sr\\x00\\x0Ejava.util.UUID\\xBC\\x99\\x03\\xF7\\x98m\\x85/\\x02\\x00\\x02J\\x00\\x0CleastSigBitsJ\\x00\\x0BmostSigBitsxp\\x93...' for column `proletarian`.`job`.`job_id` at row 1"
Not sure if I'm simply out of luck, if using MariaDB?Ok I went digging through the code to see what happens, and it seems the postgresql uuid serializer is used by default; if using MySQL, we need to explicitly set :proletarian/uuid-serializer in the enqueue! function (and I suppose the equivalent deserializer in the worker but I haven't gotten that far yet) I've looked at the MySQL serializer which turns the uuid into a byte array, and from there I wrote my own de/serializer which used .toString and UUID/fromString to de/serialize the UUIDs, seems to be working
(defn create-serializer
[]
(reify proletarian-proto/UuidSerializer
(uuid-encode [_ job-id] (.toString job-id))
(uuid-decode [_ job-id] (UUID/fromString job-id))))
...
(job/enqueue! tx job-type payload
:proletarian/uuid-serializer (create-serializer)}Proletarian has supported Maria (via MySQL) , 6 months ago?
@dharrigan I'm guessing my issue stemmed from using the mariadb uuid type rather than binary(16) . I've tested now by using binary(16) and it works out of the box with those serializers!
well-noted, and thanks!
I was looking for something like this for a while @msolli, so thank you 🙂 I did roll my own in the meantime but with a lot of sharp corners; I was able to replace my implementation with your library with minimal fuss (wrap my handler-fn's in the required 2-arity fn, was pretty much all I needed, and some start/stop code for my integrant systems).