Transparent and type safe system decoupling

A common headache in enterprise application integration:

How do you make messages sent from one system to another completely independant, extensible yet strongly typed?

By writing out Xml-messages and authoring tedious Xsd schemas to validate against? I guess that's one way to do it. If you got all the time in the world. Using my favorite C# compiler I did a small implementation of the Pipes and Filters pattern that have some interesting characteristics:

  • Each filter and message type can be completely independant. So when upgrading a filter or extending a message the new versions are not required to inherit from the existing type.
  • Two connected filters doesn't have to reference the same assembly that provides a common message type.
  • Concrete filters are implemented using strongly typed .NET parameters. The base class acts as a transparent proxy. See below.
  • Messages are piped in XML format, so a filter could be written in any programming language on any platform. Example filter implementation: [sourcecode language='csharp']class Filter1 : BaseFilter // input = dummy object {  public Filter1(IFilter next) : base(next)  { }  protected override Message1 Process(object context)  { Message1 message1 = new Message1();    message1.Foo = "I'm from Message1";    return message1;  } }[/sourcecode] Take a look at the solution and tell me what you think. [Download]
Google
m@kli.dk @klinkby RSS feed  GitHub