bowerick 2.1.0 Released

In this post, I announce the release of bowerick 2.1.0. Before going into more detail, the summary of changes is as follows:

  • Added functionality for advanced message handling for message producers and consumers.
  • Added a built-in test message/event producer for easing experiments and demonstrations.
  • Improved online management functionality.
  • Updated version numbers from 1.99.x to 2.x.y.

Advanced Message Handling

The addition of this functionality was inspired by a reply I got to an earlier post about bowerick. Thanks a lot to Evgeny (eaksenov) for the input. I hope that the new functionality is what you had in mind with your request.

Up to now, bowerick message producers and consumers only considered the actual payload. For sending, a producer only accepted a single argument, the data/payload to be transmitted. Analogously, the callback called by consumers on message reception only accepted a single argument, the received data/payload.

Advanced message handling now allows more sophisticated interaction when sending/receiving messages. Regarding the split between message producer and consumer, I consider the consumer part more complete by now. Thus, I will start the discussion with the consumer.

Consumer

With the new advanced message handling functionality, a bowerick consumer can now also accept a callback with two arguments. If a two argument callback is passed, the first argument will contain the same data/payload as for the single argument callback. The second argument, is an instance of either the received message or the message headers, depending on which wire format/protocol is used.

For OpenWire, STOMP, and MQTT, the second callback argument is the received message instance. For STOMP via WebSockets (WS/STOMP), the second callback argument is the StompHeaders instance that was received along with the payload.

Please note: while the OpenWire and STOMP messages both implement javax.jms.Message, the concrete implementations are different, e.g., ActiveMQBytesMessage respectively StompJmsBytesMessage when transmitting byte array data. Furthermore, the messages received via MQTT (org.eclipse.paho.client.mqttv3.MqttMessage) do not implement javax.jms.Message.

Below is an excerpt as example of a two argument callback function:

...
(defn cb [data msg]
 (println "Received data:" data)
 (println "Message type:" (type msg)))
(def consumer (create-consumer broker-uri topic-name cb))
...

Producer

For producers, the advanced message handling is in a rather early stage. So far, only setting custom message properties for OpenWire and STOMP is supported.

In order to set message properties for OpenWire and STOMP messages, you have to pass a second argument to a producer instance in addition to the actual payload data. The additional argument is a map in which the message properties have to be associated to the :message-properties key. The message properties have to be defined as a map of string keys and arbitrary values.

The string keys are the identifiers used for naming the message properties. What type of property, e.g., Boolean, Int, Double, etc., is used is determined based on the type of the corresponding value.

Below an excerpt is shown as example:

...
(def prod (create-producer broker-uri topic-name))
(def msg-opts {:message-properties
 {"Some Boolean" true
 "Some Byte" (byte 42)
 "Some Double" 1.701
 "Some Float" (float 1.701)
 "Some Integer" (int 1701)
 "Some Long" 1701
 "Some Short" (short 1701)
 "Some String" "Enterprise"}})
(prod "my data" msg-opts)
...

Instead of hard-coding the identifier :message-properties, the var msg-prop-key from the bowerick.jms namespace can be used as key as well.

Please note that MQTT and WS/STOMP producers also support the second argument. However, the second argument will be simply ignored for now for these protocols.

Built-in Test Message/Event Producer

For testing, experiments, and demonstration purposes, it can be beneficial to have some continuous traffic flowing across the messaging system. Thus, I added a simple built-in message/event producer for synthetically generating and sending messages.

The new message/event producer generates message with 50 Hz. The messages contain x, y, and z coordinates of, say, a point. Currently, the z coordinate is constant and on the x/y plane the point follows a circular movement.

This message/event producer is the basis for a demo, which I will cover in a separate post later.

Improved Online Management Functionality

When running bowerick in daemon mode as broker, it provides some, currently very simple, management functionality. Previously, this functionality was implemented rather coarse such that it was not very user friendly and cumbersome to extent.

The new online management functionality is based on new embedded CLI functionality, which I recently added to cli4clj. For this post, I will just go with the summary that this will help to improve usability and extendibility of the online management functionality. I will write more about this cli4clj embedded CLI feature in a dedicated future post.

Updated Version Number

Since quite some time, I hade been using version numbers of 1.99.x. Originally, my intent for using the 1.99.x versions was that the release of the next major version, 2.x.y, was imminent.

I “just wanted to implement that one big change” and then switch to 2.x.y. Unfortunately, I never really got around to implementing that change and was distracted by other more urgent or fun aspects. Thus, I did not really make it to get rid of that 1.99.x version.

However, eventually, I got annoyed by this 1.99.x thing going on for so long. So, I finally decided to switch back to some more decent versioning and just do the jump to 2.x.y.

In future, I may need to do another major version bump when the “big change” finally comes. However, so far, I think it is much easier to have a reasonable version scheme rather than continually going on with this 1.99.x stop gap solution.

End

In this post, I announced the release of bowerick 2.1.0. Besides some technical details about new features etc. I also tried to provide some rationale for the new major version number.

In addition, I somewhat teased you with an outlook on some more future posts. So, I actually owe you at least two more posts, right now.

I hope you consider bowerick useful and am happy about your feedback and comments. As you could see in this post, sometimes, coming up with a feature request may actually lead pretty quickly to a corresponding implementation.

As usual, I am very happy about any constructive feedback.

Advertisements
This entry was posted in Announcements, bowerick, Libs. and tagged , , , , , . Bookmark the permalink.

2 Responses to bowerick 2.1.0 Released

  1. eaksenov says:

    Amazing! Just what was needed. Thank you a lot.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s