Today: a nice cup of Java

It’s been a while since I’ve done any serious new work in Java, but today I needed to create a custom Wowza Streaming Engine (nee Wowza Media Server) plugin for Civico. While doing so, I decided to up my Java game a little

Dependency management: Maven

I’ve used Maven in the past, but only in a very basic sense. I am, however, quite impressed with it. A simple XML manifest file to describe the project, and the required modules and their scope, and a single :

mvn package

causes the whole thing to be compiled and a JAR file created. I’ve even got it to bundle the dependencies in the output JAR as well, which makes installation easier.

Building a Wowza Streaming Engine plugin requires a JAR file from the server installation, and unsurprisingly isn’t in the Maven repository. However, I found that creating my own “local” Maven repository was so simple that it didn’t really matter – and now the required JAR is in my local repository, I can easily build multiple modules without any hassle.

Old Java hands are probably wondering why I wasn’t using it before (and given the nature of build tool fashions, are possibly wondering why I’m still using it). Given that I was moving from a GNU Makefile with hardcoded compile and packaging rules, and no dependency management. Maven is a step up for me. There may be other (possibly even better) build tools, but for now Maven ticks all of my boxes and I don’t feel a great need to change.

The Plugin

Nothing particularly special or interesting, I’m afraid – I simply wanted a plugin that, at the end of a live stream, would update a MySQL database table with the duration of the stream. This will be used for billing purposes, and as it’s a figure taken directly from the media server, it’s safer than trying to read the duration of the saved stream. Also, as Civico allows the client to apply start and end trims to the streams before publishing, it means that the client can’t just trim their videos to reduce their bill (we did have a case where a client tried running an overnight stream test – 16 hours in total. That’s fine if you want to do it, but you’ll be billed for it, even if you decide to never publish the video)

I’ve still got a few more plugins to create and refactor, but now that I’ve got a simple and clean build process to work with, they should be easy enough to do. Some of the plugins are quite mundane and boring in scope (authentication and authorisation checks, for example) but there are some new technology things that I’m keen to start working on.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.