views:

335

answers:

4

I've been doing a lot of research lately about SOA and ESB's etc.

I'm working on redesigning some legacy systems at work now and would like to build it with more of a SOA architecture than it currently has. We use these services in about 5 of our websites and one of the biggest problems we have right now with our legacy system is that almost all the time when we make bug fixes or updates we need to re-deploy our 5 websites which can be a quite time consuming process.

My goal is to make the interfaces between services loosely coupled so that changes can be made without having to re-deploy all the dependent services and websites.

I need the ability to extend an already existing service interface without breaking or updating any of its dependencies. Have any of you encountered this problem before? How did you solve it?

A: 

What you're asking isn't an easy topic. There are many ways you can go about making your Service Oriented Architecture loosely coupled.

I suggest checking out Thomas Erl's SOA book series. It explains everything pretty clearly and in-depth.

Justin Niessner
I appreciate your response. I know that this is not a easy topic. I've been researching it for the past month it seems. I've watched a few presentations on InfoQ also looked a few books online so i have a pretty good understanding of what the end product needs to look like but having a hard time getting from point A to point B. I'll take a look at the book you suggested maybe it will help clear things up a little.
Brian
Justin, by any chance are you aware of any online resources throwing some light on this partucular question.
ydobonmai
+4  A: 

I suggest looking at a different style of services than maybe you've been doing so far. Consider services that collaborate with each other using events, rather than request/response. I've been using this approach for many years with clients in various verticals with a great deal of success. I've written up quite a bit about these topics in the past 4 years. Here's one place where you can get started:

http://www.udidahan.com/2006/08/28/podcast-business-and-autonomous-components-in-soa/

Hope that helps.

Udi Dahan
I never thought of that. Its funny because I downloaded a copy of your open source ESB nServiceBus about a week ago. Only browsed the code for about an hour and I assumed that what you were doing wouldn't solve my problem. I saw a bunch of classes that were being passed around between the publishers / subscribers and it made me think that any changes would cause any dependencies to be rebuilt. After reading what you posted it all makes sense. They're passing individual messages around through events not the entire service interface. I can add new messages without breaking any existing code.
Brian
+3  A: 

There are a couple of approaches you can take. Our SOA architecture involves XML messages sent to and from the services. One way we achieve what you describe is by avoiding the use of a data binding library to our XML schema and use a generic XML parser to get just the data nodes you want ignoring those you aren't interested in. This way the service can add additional new nodes to the message without breaking anyone currently using it. We typically only do this when we need just one or two pieces of information from a larger schema structure.

Alternatively, the other (preferred) solution we use is versioning. A version of a service adheres to a particular schema/interface. When the schema changes (e.g the interface is extended or modified), we create a new version of the service. At any time we may have 2 or 3 versions on the go at any one time. In time, we deprecate and then remove older versions, while eventually migrating dependent code onto newer versions. This way those dependent on the service can continue using the existing version of the service while some particular dependency can 'upgrade' to the new version. Which versions of a service are called are defined in a configuration file for the dependent code. Note that it is not only the schema which gets versioned, but all of the underlying implementation code as well.

Hope this helps.

Chris Knight
Yes this defiantly is one solution that would work too. However I think the biggest problem I had wrapping my head around all this was that when I thought about a service I was thinking that it requires a service contract much like the one used in WCF Services. When you break it down and turn each API function into its own message solving this problem becomes much easier. Because you can add as many messages as you want to the service you can now add aditional versions and new messages to the service.
Brian
A: 

There are a few common pratices to achieve loose coupling for services.

  1. Use doc/literal style of web services, think in data (the wire format) instead of RPC, avoid schema-based data binding.

  2. Abide strictly by the contract when sending out data, but keep few assumptions processing incoming data, xpath is a good tool for that (loose in, tight out)

  3. Use ESB and avoid any directly point to point communication between services.

vtd-xml-author
Yeah i decided to use an ESB NServiceBus. It seems to have solved most of my problems.
Brian