The aim of bowerick is to ease simple Message-oriented Middleware (MoM) tasks with Clojure and, to some extent, with Java. The general functionality that is offered by bowerick is:
- Creating message producers and sending messages.
- Creating message consumers and receiving messages.
- Programmatically running embedded MoM brokers.
bowerick also offers more advanced features. However, I want to keep this post concise. Hence, I focus on the most fundamental features.
bowerick supports the following protocols for clients and servers: OpenWire (UDP & TCP), STOMP, STOMP via WebSocket, and MQTT. All protocols except OpenWire UDP can also be used via encrypted connections (SSL/TLS).
In this section, I want to briefly summarize the history of bowerick. I hope that having a bit of historical context will help you to determine whether bowerick fits your needs or not. If you are more interested in the technical aspects, just skip this section and continue reading with the next section.
I initially started the development of the project (clj-jms-activemq-toolkit) that gave rise to bowerick during my PhD thesis and employment as researcher at the Frankfurt University of Applied Sciences. Hence, you will find the copyright of the university in various places.
Back then, my main need was to have something that helped me with some experiments that I did as part of my research work and for my PhD thesis. Essentially, I wanted to have abstractions to ease simple MoM tasks and I also implemented prototypes for evaluating some ideas which partially continue in bowerick.
bowerick started as a fork of clj-jms-activemq-toolkit. From my perspective, bowerick is the direct continuation of clj-jms-activemq-toolkit, for which I was the only contributor anyway. The intention of the fork is to signal the changed scope of bowerick, from a loose collection of JMS tooling and prototypes to something, hopefully, more evolved.
However, please be aware that bowerick is still a toy project of mine. Future development is primarily driven by “fun aspects”. Nonetheless, I hope to provide a solid project that is helpful and easy and fun to use as you can see, e.g., in the continuous integration, API documentation, and test coverage efforts. Since the fork of bowerick, I also performed extensive re-factoring and further development in order to improve code and capabilities for which I did not have the time while I was writing my dissertation.
The main aim of this post is to provide a brief introduction of bowerick. Hence, I will focus on the fundamental features.
I think the most illustrative way to show the fundamental functionality (producer, consumer, embedded broker) is to show an example code snippet. In the following listing, a corresponding example is shown:
; Can also be run in: lein repl (require '[bowerick.jms :as jms]) (def url "tcp://127.0.0.1:61616") (def destination "/topic/my.test.topic") ; Create an embedded broker. (def brkr (jms/start-broker url)) ; Create a consumer that prints the received data. (def consumer (jms/create-json-consumer url destination (fn [data] (println "Received:" data)))) ; Create a producer ... (def producer (jms/create-json-producer url destination)) ; ... and send some data. (producer "foo") ; nilReceived: foo (producer '(1 7 0 1)) ; nilReceived: (1 7 0 1) (jms/close producer) (jms/close consumer) (jms/stop brkr) ; (quit)
As embedded broker and for the OpenWire protocol, bowerick uses Apache ActiveMQ. For the other supported protocols, bowerick uses different other libraries.
In the following listing, examples for URLs of supported protocols are shown:
; ; Encrypted ; ; OpenWire via TCP (def url "ssl://127.0.0.1:61616") ; STOMP via TCP (def url "stomp+ssl://127.0.0.1:61616") ; STOMP via WebSocket (def url "wss://127.0.0.1:61616") ; MQTT via TCP (def url "mqtt+ssl://127.0.0.1:61616") ; ; Unencrypted ; ; OpenWire via TCP (def url "tcp://127.0.0.1:61616") ; OpenWire via UDP (def url "udp://127.0.0.1:61616") ; STOMP via TCP (def url "stomp://127.0.0.1:61616") ; STOMP via WebSocket (def url "ws://127.0.0.1:61616") ; MQTT via TCP (def url "mqtt://127.0.0.1:61616")
As bowerick is the continuation of clj-jms-activemq-toolkit, the versioning continues where the original project stopped. Currently, I think that the re-worked API etc. is pretty much stable. Still, the current version is 1.99.x, which indicates its state as a sort of preliminary version before the 2.x release. However, I think that the, at time of writing, latest version 1.99.5 is a pretty good candidate for the final 2.0.0 release.
I hope that you consider bowerick useful. I intend to post more details about bowerick and more of its features in future posts. Feedback and comments are always appreciated.
Pingback: bowerick: Serialization Convenience, Command Line Helpers, and To-dos | ruedigergad