Tag: Java

A web service powered by Spring and Drools

For the past few years I have been designing and building web services which make use of decision management technology such as Drools and FICO Blaze Advisor. The past year or so has all been about using Drools Guvnor to enable business users (legal and operations teams) manage rules, and using the Drools rules engine to evaluate trade requests against those rules.

My preference in setting up web services is to use the Spring Framework to configure my application and manage its various components. However, I struggled to find much information online about how best to wire up a Spring web application to make use of Drools for rules evaluation. The Drools documentation does include a chapter on Spring integration, but I found that it didn’t seem to make the integration any simpler, and forced dependencies on older versions of Spring that I didn’t want to use. In the end, I decided to hand-crank the integration in my application, and it turned out to be quite easy to do.

Continue reading “A web service powered by Spring and Drools”

Bundling project dependencies with the shade plugin

Have you ever struggled with the mass of .jar files that you can find in a directory of Java libraries? You have no idea what version each of them is and what its dependencies are. You want to put your own application jar in there, but you know that will mean needing to get hold of 20 other jar files to deal with its dependencies.

Continue reading “Bundling project dependencies with the shade plugin”

Getting the latest snapshot from Sonatype Nexus

Sonatype Nexus is a repository for build artifacts, which is particularly handy if you have a Maven project. Once you have your Maven project configured, every time you run mvn deploy Maven will do a bit of building and then upload the resulting artifacts (.jar, .war, …) to the repository. If you browse Nexus you will then be able to find those artifacts with a unique name and download them.

This is all great, but if your project is running on a snapshot version, then every time you deploy to Nexus, the artifact file name will be appended with date and an ever-incrementing number. For my purposes, I wanted to be able to go on to a Linux test server where I have Apache Tomcat installed and grab the latest .war file. Maybe I need to relax more, but I was getting a bit irritated with having to manually find the snapshot in Nexus, copy the link and then fire off a curl -O -L http://... command every time I updated the project.

Continue reading “Getting the latest snapshot from Sonatype Nexus”

Playing around with Apache Camel

Originally posted @ gratiartis.org on May 12th 2011.

I have been playing around with Apache Camel for a couple of projects recently, and so far I’m very impressed. Camel is one of a number of frameworks that seem to have sprung up over the past few years in response to the book Enterprise Integration Patterns by Gregor Hohpe and Bobby Woolf. It attempts to provide mechanisms to support all the patterns described in the book. And it does so very well, from what I have experienced so far. So I thought I would mention a couple of things I have done with it.

Continue reading “Playing around with Apache Camel”