Playing around with Apache Camel

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.

A simple content-based router

The problem I was trying to solve was that a legacy application was designed to listen to a WebSphere MQ queue, which would contain requests for a variety of operations. A new application had been developed to handle a subset of these operations. I couldn’t have both applications listening to the same queue, so I needed to divert particular operation request messages to a separate new queue.

Continue reading

WebLogic Scripting Tool – Scripts

I mentioned my use of the WebLogic Scripting Tool a little while back. I have noticed since then that a number of folks visiting this site are looking for example scripts. I have obviously written a number myself and I promise I’ll try to get around to posting them here. However until I get myself in gear, I thought I would point you at some useful examples that are already out there. I’ll expand this post as I find more…

Continue reading

Open source financial libraries for Java

The financial industry does seem to be loath to share the fruits of their efforts. There doesn’t seem to be a lot around. And certainly not much that is regularly updated. Maybe everyone is worried about sharing trade secrets, but the rules for calculations are well established and I’m guessing that everyone must be writing their own implementations or buying in over-priced modules.

Continue reading

Groovy as a financial domain language?

As a developer of financial systems, I’m constantly disappointed by how difficult it is to perform precise decimal arithmetic in Java. It’s fairly common knowledge that the use of double is not much use for financial calculations. As a quick example, take a look at the following piece of code.

public static void main(String arg[]) {
    BigDecimal bd = new BigDecimal("58.99").add(new BigDecimal("0.99"));
    System.out.println("BigDecimal result: " + bd);

    double d = 58.99 + 0.99;
    System.out.println("Double result: " + d);
}

You would have thought both results should be the same. However, you end up with:

BigDecimal result: 59.98
Double result: 59.980000000000004

Continue reading

Programming in Java book

My dad passed away on April 1st 2005. At the time he had been working on a book, aimed at introducing the Java programming language as part of a university course. The project had taken a long time and was never quite finished, but near the beginning of 2005, he has finished his last chapter. Having dug around on his iBook, I found the most recent Word document in which he had been preparing the book. Reading it through, it was obvious that it would need a good bit of work before it could be publishable. Continue reading