Skip to content
This repository has been archived by the owner on Aug 31, 2019. It is now read-only.
/ mq Public archive

A simple clojure library to embed an ActiveMQ instance in your application

License

Notifications You must be signed in to change notification settings

puppetlabs-toy-chest/mq

puppetlabs-mq

A simple library to embed an ActiveMQ instance in your clojure application.

CI Build Status

Usage

(ns user (:require [com.puppetlabs.mq :refer :all]))

;; Create and start a broker
(def my-broker (doto (build-embedded-broker "my-broker" "/tmp/broker-storage")
                 (.setUseJmx false)
                 (.setPersistent false)))
(start-broker! my-broker)

;; Connect to the broker:
(def connection (connect! "vm://my-broker"))

;; Publish a message to the "hello-world" queue:
(connect-and-publish! connection "hello-world" "Hello, World!")

;; Retrieve the published message from the queue:
(bounded-drain-into-vec! connection "hello-world" 1)
;; => ["Hello, World!"]

;; Stop the broker
(stop-broker! my-broker)

;; delete the storage directory
(clojure.java.shell/sh "rm" "-r" "/tmp/broker-storage")
    ;; done this way for brevity; IRL do this with e.g. https://clojars.org/fs

License

Copyright © 2014 Puppet Labs

Distributed under the Apache License, version 2.

About

A simple clojure library to embed an ActiveMQ instance in your application

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published