At the ArcReady seminar, Chris Madrid discussed the MSE's support for custom policies. This is the extensibility point in MSE for adding your own WCF behaviors into the MSE's runtime. He showed some simple examples like turning off the metadata output of a service.

The cool thing is that you can inject any behavior you want into the engine. Some ideas that he mentioned:

  • Publishing info to BizTalk's BAM service so that we can analyze the traffic going in and out of the web services.
  • Logging messages to some sort of store.
  • Adding authentication or authorization.
  • Content based routing to send "gold" level clients to one farm and "normal" clients to another farm. This would help with meeting tighter SLA requirements of an important client. This might require doing a lookup to a database, which is an example of how flexible the behaviors can be.

Last night, I did some digging to figure out how this worked. It's pretty neat.

The MSE runtime reads the policy from the catalog. The policy is written in XAML. The XAML tells the runtime which objects to instantiate and how to configure the objects. The objects need to be a set of classes that implement WCF behavior interfaces so that the MSE runtime can then inject these into the WCF service as messages pass through the system.

Pretty slick stuff and a creative, but appropriate use of XAML.

Now, I just need to deep dive on WCF to understand behaviors more.