I stumbled across Phil Windley's blog about Linda and Service Oriented Architectures today and found myself disagreeing a little - I think MOM (Message Orientated Middleware) and tuple spaces are much more alike than you might think.
The primary difference between tuple-spaces and message-based system is that message-based systems require a delivery endpoint, or at least need a way to discover one. One process sends the message specifying the task to be done to another process. Tuple-spaces are more like bulletin board systems, where the originating process merely specifies a need and other processes meet that need as they can. Linda was the inspiration behind Jini's JavaSpaces.
I don't quite agree - a MOM acts like a bulletin board too; anyone can put or take from the queues and topics.
In a MOM you send a message to a Queue or Topic, which is really just a name like a URI in the web / REST - its got nothing to do with the other process - so think of the queue name as like the Space variable in a tuple space program.
i.e. there's very loose coupling in MOMs too - afterall its one of the main points of MOM in the first place :).
This may sound like topic-based pub-sub systems, but there's a subtle difference. In tuple-spaces, processes search the tuple space, using a pattern language, for matches rather than subscribing to a particular topic.
MOM systems use selectors which are SQL query predicates that serve a similar purpose as the pattern language in a tuple space - which compared to JavaSpace's simplistic reflection based pattern language, is a great improvement :)
Consequently, you can use a tuple-space to implement a topic-based pub-sub system, but not the other way around. In the same way that searching on the Web is a small, but significance departure from Web-based directories, tuple-spaces are a small, but significant departure from message-based pub-sub systems.
You can build a MOM from a tuple space and a tuple space using a MOM. e.g. ActiveSpace is a tuple-space like abstraction which sits, efficiently, on top of any MOM.
MOMs are inherently event based using a message passing, SEDA style model of communication; a MOM logically represents pipes of messages flowing around a system. A tuple space can be used in this manner too, but its API is more random access, getting/taking based on a predicate one object at a time.
For me the main differences between MOM and tuple spaces is that with a MOM you typically subscribe to a selection of events (event based); whereas in a tuple space you tend to ask for them one at a time (random access). So a tuple space feels a bit more like a collection, whereas a MOM feels more like a pipe or event listener.
But I think they are similar in many ways, particularly how people use them. Many tuple space use cases and examples are the decoupled producer-consumer worker pattern which is similar to using queues in a MOM to load balance work across a number of processes.
10:23:49 AM
|
|