Scripting and asynchronous messaging

One of the lessons we can learn from early success of the Web was making of ideal environment for use of scripts. There were two main components of the Web platform:

  • Web server (Apache), as an infrastructural component that had to be fast and reliable
  • Web application as a collection of scripts (Perl, PHP, Python), providing the content in an easy manner

The Web as we know it today is a much different place; applications talk to each other through variety of web service protocols, we have Ajax and all these new cool toys. But one principle remains the same: we need reliable infrastructure software with easy integration of scripts for fast creation of content and logic.

I’ve always seen Java as an ideal platform for building infrastructural applications. One of the proofs for this claim is existence of many production-ready asynchronous-messaging solutions on the Java platform. Asynchronous messaging is an important programming concept which is one of the reasons for Java’s success in the enterprise environment. JMS specification and many quality implementations of brokers and clients led to wide adoption of messaging paradigm among Java developers.

Recent trend towards bringing asynchronous messaging closer to scripting world is very encouraging (in my opinion) as it will bring completely new programming concepts to script developers and much wider adoption of asynchronous messaging patterns.

What I primarily have in mind here is Stomp (Streaming Text Orientated Messaging Protocol), a lightweight messaging protocol, which makes it easy to implement clients for most of the scripting languages (the most of the mainstream scripting languages already have Stomp clients implemented). Currently only ActiveMQ implements native Stomp support and enables script developers to enjoy all goodness of loosely-coupled asynchronous integration of their applications. Support for virtually any JMS broker is provided through StompConnect project.

One other potential alternative to Stomp is AMQP (Advanced Message Queuing Protocol), the specification that aims to standardize messaging. Intention of AMQP is not to be simple, but to provide standard specification that will allow implementation of brokers and clients in virtually any programming language.

AMQP is young specification and currently you can find it implemented in Qpid ( project in Apache’s incubator. It currently implements brokers in Java and C++ and clients in Java, C++, C#, Python and Ruby. The other open source project that implements AMQP protocol is RabbitMQ, which is written in Erlang and provides clients in Java, JavaScript and native Erlang.

Regardless of the actual protocol and technology being used, I think that asynchronous messaging and scripting provides a lot of potential to developers and I’m sure we will hear a lot of about these two playing together in coming years.

Leave a comment

Your email address will not be published. Required fields are marked *