July 08, 2007
On Intermediation And SOA
Nick Malik has an interesting post on The value of intermediation in SOA where he starts out suggesting a couple of books that stand at the basis of much of today's SOA thinking. I agree that far too few people seem to have read them.
In his previous post Is it service-oriented if the message cannot be intermediated, Nick defines intermediability as "SOA should give us the ability to intercept a message going from point A to point B, and react to that message without informing either end of that pipe.". I'll respond to this in due course.
Anyway, he continues on by saying "SOA [is] an architecture for Enterprise Application Integration."
I can't agree with that statement. The main reason is that EAI puts the application in the center, and that integrating existing applications one of the primary purposes of it. It is my assertion that in order to solve many of the problems that we are having today, we need to take a broader, business based view of the enterprise and model that with services. A service may be implemented with one or more applications. However, my experience has been that these services tend to use parts of existing applications, with multiple services using different parts of the same application. The reason for this is that the applications we have today, especially the ERP monoliths, do a lot, and at the same time, not everything. This is part of the reality that EAI tried to solve, but then got mired down in cross system hell. You just can't solve poor business decomposition in the technology domain.
The value of putting services at the fore makes it possible to gradually phase out and evolve legacy applications, and migrate costly mainframe apps bit by bit without having these changes ripple out and break other services. The same is true for those systems' data - backup strategies are defined at the service level, impacted primarily by their Service-Level Agreements.
While I whole-heartedly agree with what Nick has to say in terms of OO intermediation of the Dependency Injection variety, and that scaling up those same concepts in terms of messaging is the right way to go, I take issue with orchestration in the intermediation area. These "tactical changes" need to be done in the context of the top, business-level service strategy. That means that all logic belongs within a service. The "network" between services is just that, a "dumb" network - no business logic of any kind, just technological capabilities like knowing which physical server to route messages to.
In this spirit, I'd like to suggest an alternative solution to the example Nick gives. Here's the scenario:
Let's say that system 1 generates an invoice. It sends an event to the world saying "invoice here" and system 2 captures that message. System 2 asks for details about the invoice... perhaps it will place the information on a web site for internal support teams.
Let's say that we are moving to a CRM solution in our internal support groups. We want to create the information in the CRM system related to the invoices that specific customers have been issued. We need to integrate these two systems. The existing web app needs to have a link to the CRM system's data, to allow the user to move across easily.
And here is the solution he prescribes:
We can intercept the request for further information from the web app to the publisher. When the publisher responds with information about the invoice, we can insert the invoice in the CRM system, add a link to the CRM record for that invoice to the data structure, and resume our response to the web app. Assuming that our canonical schema has a field for 'foreign key', we have just integrated our CRM and web information portal... without changing either one.
Without getting into the business-level analysis of what the correct service decomposition might be, here's what I suggest (although all of these "systems" might just end up within the same service, or having parts of them being used by multiple services).
First of all, have all information about the invoice available via the message only. This could be done by actually putting all the invoice data in the message, or by placing a URI instead where other systems can HTTP GET it from - REST style. This decreases coupling between the publisher and its subscribers. However, we haven't solved the problem of our web apps getting access to the relevant data in the CRM system.
The solution presents itself at the business level. The invoice is not "complete" without the appropriate CRM data. Therefore, it does not make sense for a service to publish it that way. Let's call this service the Purchasing Service. It would handle the workflow of receiving the first system's event, adding the invoice to the CRM system, and taking the resulting full invoice data and publishing that. All external systems like the web apps would see just the final event. Orchestration, if there even is such a thing, occurs within the service boundary. This technological level intermedation isn't even a blip at the business level. We can also imagine other services, say a Sales Service, that would use the CRM system as well.
In summary, when moving to SOA, intermediation provides many technological benefits in getting data and behavior to work across existing systems and applications, however it's laregly a NO-OP at the service level. After phasing out many of those existing applications behind the service boundaries, the same service-level interactions would persist. Your Service-Oriented Architecture would not be any different. That's the technical agility aspect of SOA.
Posted by Udi Dahan at 05:01 PM Permalink
|