Enterprise Social Messaging

August 8th, 2008

Here’s an interesting video that explains ESME which runs on the lift framework, backend by SAP NetWeaver. Very, very cool.

Enjoy!

I just came across a great Scala presentation from JavaOne. If your not looking at learning Scala, then this presentation will give you a whole heap of reasons to get up and do something about it.

Download the article from here

Its been in the wings for some time now but the announcement has finally been made public. This is great news as it means that when were coding in Scala the classes in your web container will automatically be updated without the need to restart the container and redeploy the WAR.

For more on this check out the announcement

Right, as you know, I use the lift framework a lot these days. I also use Resin as my choice container. So, i recently got to thinking, wouldn’t it be cool if i could just bosh together a simple way to expose controllers in lift via the groovy protocols made available by Resin – well, I have here an example of just such a thing.

Lift Side

Ok, before anyone has a poke at this code… it was a very quick and dirty example, so its not ideal, and obviously your code would be a whole lot more complex, but this article is just about proving concept.

I set up the object that I want to expose via remoting. Critically, there would be nothing stopping me using the persistance built into lift, or anything else available to java or scala for that matter. The key is the traits… as they are like java interfaces (broadly speaking), they let resin know what methods it can call.



package com.timperrett.resin.example.controller

trait HelloTrait {
  def hello: String
}
class HelloWorld extends Object with HelloTrait {
  def hello = "Hello from lift" 
}

Resin Configuration

Next, we add a bit of config to resin so that it knows how/where to expose the service. Critically, we could have used Hessian, Burlap or CXF (for SOAP) and all by being pushed out of the container with zero extra effort.


<web-app id="/lift-remoting-example" 
   root-directory="webapps/lift-remoting-example">
  <servlet-mapping 
   url-pattern="/api/hello-world" 
   servlet-class="com.timperrett.resin.example.controller.HelloWorld">
    <protocol uri="hessian:"/>
  </servlet-mapping>
</web-app>

Client Side (in another language!)

To proove the point, I thought I would just make a simple client in another language (namely ruby):



require 'rubygems'
require 'hessian'

url = http://127.0.0.1:8080/lift-remoting-example/api/hello-world
client = Hessian::HessianClient.new(url)
puts client.hello

Again, a very simple example, but one that proves the point. You should then see “Hello from lift” output in the terminal window.

Project Files

You can download my example from here

If you found this article interesting, or have played with this yourself also, then by all means leave a comment or get in touch.

My appologies; I hardly ever blow my own trumpet on this blog, but I just cant let this one pass without a good old toot of the proverbial horn.

Today I joined the lift committers. That might not sound much, but when you think that lift will be the next Ruby on Rails size phenomenon to hit the development community, thats pretty dang awesome.

I shall toot no more – respect to David and the rest of the other guys on lift core… you freaking rock!