Tag Archives: Java

ESB = Enterprise Service Bullocks

As you can see from the title I’m not a big fan of Enterprises Services Buses.

I’m not the only one, Jim Webber motivated already in these nice slides why, I’ll just add my impressions, as a newbie.

I’ve tried using serviceMix and I had a quick look to some other not OS vendors.

The first weird thing is that everybody is writing an ESB, you got so many choices, even the Apache foundation has two ESBs: ServiceMix and Synapse, must be an easy thing to write is so many companies are writing their own version: don’t assume knowing and writing code for one will work elsewhere!

The second very bad thing is maintenance. I had to change a little some JBI components written a couple of months ago, it has been painful, ServiceMix is all about XML configuration but you have no clue on what’s talking with who, which service is connected to what and why, you change a name and bang, nothing works anymore. Aweful.

You might buy one of those cool ESB (Oracle, Tibco, the list is long) offering a “nice UI” to drag and drop components, well I’m sceptical, never been a big fan of this type of tools (vendors too, to be honest).

Testability. Assuming that you care about testing how do you want to test this stuff? Writing long running integration tests?

I tried a little and I ended up pinging ServiceMix to understand if it’s up or not (it akes honestly ages to came up) and do some clever wait on JMS queues for messages in order to understand if the bus still works but hey… That’s not cool at all. It’s slow and breakes very easily.

Instead of an ESB you might consider the architecture proposed by Jim on the slides mentioned above, if that’s not enough (maybe you’ve got some syncronized JMS queues) you might try to have a look to Scala, I think (and I’ll try to write something more about it) you can write an ESB (only what YOU need, no XML, no bullshit) in a day or so with a couple of Scala Actors.

Maven Facts

  1. Maven will never tell you which phases or goals are available in the pom, you have to guess or check the on-line documentation
  2. Maven by default uses text files to dump the test execution results, if you want to see what’s happening on the console you have to call it with -Dsurefire.useFile=false
  3. Maven can skip the executions of the tests (sometimes might be useful!) call it with -Dmaven.test.skip=true
  4. Maven knows what inheritance is (and therefore claims that it’s object oriented… grrr…) so if you can’t find where some property is defined have a look up on the parent
  5. Maven is based on XML but you won’t write as much XML as with Ant
  6. Maven can create Eclipse project files and even download the sources for you (mvn eclipse:eclipse -DdownloadSources=true)
  7. Maven downloads stuff from the internet  (#1 failure reason for 99% Maven presentations) but can be run in offline mode (if you had a sucessfull install previously), try mvn -o
  8. Maven uses repositories, but since not all the libs in the world are in repositories you should setup a local repository (Archiva works well)
  9. Maven uses repositories, but since you don’t want to hog all your company bandwith you should setup a local repository
  10. Maven goes great with stuff like Hudson, Sonar
  11. Maven build profiles are really cool
  12. Maven is not silver bullet but I’ll never go back to Ant

You might want to keep an eye on these four opensource project…

  • Apache ODE (Orchestration Director Engine) executes business processes written following the WS-BPEL standard. It talks to web services, sending and receiving messages, handling data manipulation and error recovery as described by your process definition. It supports both long and short living process executions to orchestrate all the services that are part of your application.
  • JBoss DNA is a new unified repository system that is JCR-compliant and capable of federating information from a variety of systems. To client applications, JBoss DNA looks and behaves like a regular JCR repository that they search, navigate, version, and listen for changes. But under the covers, JBoss DNA gets its content by federating multiple external systems (like databases, services, other repositories, etc). This way, the unified repository content stays up-to-date and in sync, even though the external systems still own the information and existing applications still work. Plus, JBoss DNA sequences the content in the repository, extracting patterns and structured content that makes the repository more useful and effective.
  • Convergence is a project aimed at integrating Computational Grids with In-Memory Data Grids (IMDG)

Data repository

  • repository for storing flexible records in Amazon SimpleDB manner
  • CRUD
  • underlying storage is HBase – distributed storage for massive data hosting – Learn more…

Logs repository

  • Collecting logs from many sources/interfaces like (remote) files, JMS, HTTP and dedicated API

API/interface

GUI/Console interface

  • GUI interface with many capabilities
  • Trace/control Core module in real time

Tracing events (CEP/ESP)

  • Registering logical events that can be identified and used in rules
  • Rules can trigger specifing events to alert/trigger another events on some specific circumstances

Metrics

  • Measuring time of invocations – record time/context before service is invoked and after
  • Collect metrics reports for specific services

Processing (data)

  • Collected data can be processed by scheduled, automatic tasks
  • Unification of models can be done using adaptive processing
  • Aggregating, normalizing,…

Session management

  • Providing session token based authentication/authorization across multiple applications
  • Authenticate once and be logged to entire federation of applications, SSO

Application monitoring

  • Monitoring services
  • Report failures

OSGI integration

  • The application is supposed to be an OSGI bundle

Mavenized

It’s almost two months now that I use Maven every day, I have to say that it helped me a lot, I’m much more productive. 

There are, indeed things that I don’t like and problems but the dependency management is really sweet, the project setup too, with the archetypes. 

Some good links to start if you’re still not mavenized: 

I still get annoyed sometimes, with the xml, with some weird repositories publishing strange versions, or just with Log4J for example, depending on libraries not available on any repository, but hey, Maven downloaded for me, only once, only in one place hundreds of jar, I’ll really never do that job again by myself.

Waffles are good, do you fancy a Waffle?

During ThoughtWorks University XI we took the decision to introduce to the trainees Waffle as an example of MVC framework

I’ve been impressed by the simplicity of the framework. It has been a while since the last time I’ve played with any Java Web Framework ( I think it was around 6 years ago the last time, using the super hated Struts 1.0! )

So the first good news is the Java world is alive and some good people are writing great frameworks ( with also the big help of all the knowledge/experience gained using other languages) 

I’ve a very personal opinion on this: many people moved to Ruby and have such a bad remembering of the old times in Java, well I think that frameworks like Waffle keeps the name of Java high. 

In addition to that Waffle has a nicer design compared to Rails, no command line scripting ( you might like it, I don’t ), it’s not annotation heavy and you don’t have to write a line of xml ( ok, just one but in the web.xml! )

The only bad thing of Waffle is that there’s not that much documentation on the web ( I’ve to say that it’s so simple to use that you don’t need it! ) so my goal for the next months will be blog as much as possible about it and prepare some speeches too.

When I find something good I definitely want to spread it, and this is the case.

Waffles are good, do you fancy a Waffle?

 

 

Waffle is different from the multitude of web frameworks that exist today, in that Waffle:

  • has no mandatory XML configuration files (beyond a minimalist web.xml required by any J2EE-compliant webapp)
  • is interoperable with best-of-breed UI templating technologies
  • does not have a base controller class to extend or interface to implement
  • has controller classes that can support multiple actions, each a single method rather than a sequence of initialiation/settter/execute methods
  • has a small learning curve

 

HelloWorld v 2.0

Once upon a time we used to write:

public static void main(String[] args) {
   System.out.println(”Hello World”);
}

Now I prefer:

@Test
public void shouldSayHelloToTheGivenName() throws Exception {
        // given
        PrintStream mockStream = mock(PrintStream.class);      
Greeter greeter = new Greeter(mockStream);

    // when
    greeter.helloworld(”toni”);

    // then
    verify(mockStream).println(”Hello world, toni”);

}

The test is of course using the beautiful test double framework Mockito

Reviving JRake

The post about the need of a new build tool had many comments and reactions so I started, before coding something brand new, to search on the web for something to solve the current, well known build tools problems.

I found out that Gant is pretty cool but then I started to search for something using ruby, rake and java…

And I found that back in 2006 Martin Fowler and Mattew Foemmel were already talking and working on this…

So I’ve sent an email to Mattew since his svn repository wasn’t neither working, I’ve got the code of his jrake and I’ve started a project on Google code, the name, unfortunately is j-rake (another jrake project was already there).

I’ve just did the first check in, compacting the vendor folder on all the scripts. J-Rake in fact comes out with jruby, rake and all the libraries you need to compile and test your code.

The next small step will be to upgrade all the libraries to the latest version, then some more clean up and then writing more examples on how to write J-Rake tasks.

I’ve a very bad rake/ruby knowledge so any help/suggestion is more than welcome.

It’s time to write a better build tool

That’s what I’ve heard more than one time in the last months, half of my friends complain about maven, the other half is just almost happy with ant. The rubists are generally happy with rake, the biggest problems are on the java/.net world.

So I thought about branching ant and rewriting it in a slightly different way, using yaml instead of xml and having always only one option for any task parameter. I always hated and found difficult to remember how to do things in ant since there are always two or more good alternatives (like why there’s a dir and a file parameter option in the delete command? Isn’t a directory a file?).

So, I don’t think I’ll be able to allocate a lot of time to this, but I would love to hear something from you, ideas and comments.

In the last weeks I’ve started to write a shared mind map with Staffan Nöteberg on micro time boxing… Maybe we can do the same with this topic.

Ping me if you’re interested.

Fan Programming Language

I’m just having a look to Fan and it seems quite a cool language, soon more posts on this.

Fan Programming Language: “Portability
Write code portable to both the Java VM and the .NET CLR.

Familiar Syntax
Java and C# programmers will feel at home with Fan’s curly brace syntax.

Concurrency
Tackle concurrency with built-in immutability, message passing, and REST oriented transactional memory.

Static and Dynamic Typing
Don’t like the extremes – take the middle of the road.

Elegant APIs
We’re quite obsessive about providing all the key features required for a standard library, but with much less surface area than the APIs found in Java or .NET.

Object Oriented
Everything is an object.

Mixins
Interfaces but with implementation.

Functional
Functions and closures are baked in.

Serialization
Built-in ‘JSON like’ serialization syntax makes Fan ideal for declarative programming too.

REST
Model data with a unified namespace of resources identified with URIs.