共用方式為


Flying The Friendly EDRA Skies

I’ve been spending the last few weeks on the road, splitting between business and pleasure. New York City, New Jersey, and California have been my destinations and my credit card companies have been getting nervous about the activity (“he’s everywhere!”). Of course, with travel comes a steady diet of airports. Fortunately, I’ve had my share of direct flights, which is something that becomes more and more of a must as I grow older—I’m losing patience for layovers, I guess. But you don’t care about that, do you? Your wondering—what does traveling have to do with patterns & practices ? As usual, I am trying to make a point in my typical slow fashion…

We recently put out another drop of the Enterprise Development Reference Architecture (EDRA), an app framework we put out in for community consumption and evolution. In it, we created a transport-independent framework to separate your services from your business logic. Essentially, each message is encapsulated in a Context object that contains all the relevant metadata, authentication credentials, etc. When a message is received by a service, it goes through a pair of pipelines: the first performs all the standard checks for that overall service and then the second performs specific checks for that business action. So, in the case of the service, you can authenticate the user, log the request, etc., while the pipeline for the specific business action may contain checks for authorization, validate requests, etc. As the team was working on EDRA, I found the approach fascinating. I think most people identify this with aspect-oriented programming, but I was even a novice at that, so this is all new territory for me. I don’t know if I am sold on the idea, but while I was waiting at SeaTac Airport in Seattle, things started to make a little more sense for me about EDRA…

When I decided to fly from Seattle to New Jersey, I was essentially making a “business request” (get me to Jersey!). I bought a ticket on-line that essentially wraps me in a Context object. When I get to SeaTac airport, there is a lot that happens before I get to execute that logic behind the request (get on the plane flying to Jersey). First, they run me through pipeline#1 (the Alaska Airlines pipeline). There, they “authenticate” me (check my ID), log my visit (check me in), and provide a boarding pass for authorization. They then pass me to pipeline#2, the security checkpoint. There, I am authorized (show ticket and ID to prove I am eligible to pass) and checked for exceptions (metal detectors, x-rays, de-shoeing), Finally, assuming I pass those two pipelines, I can finally go to the gate and reach the business action (flight to Newark). I’m not saying the analogy is perfect (nor are airports :>) and, in fact, it’s a little bit backwards in that the generic pipeline happens after the action-specific pipeline. Still, it helps understand the value of pipelines and, for that matter, multiple pipelines. By standardizing certain services shared across all airlines (like security checkpoints) and others within the airline (like check-in procedures), it enables a nice mix of granularity in checks before I get to the business action. A lot of sanitization can occur and improper requests can get kicked back. Just like the requirements of air travel, applications are under major security scrutiny. Optimizing resources to properly handle requests is vital to both situations and I kinda think EDRA may be on to something with this approach.

Of course, this isn't completely new. WSE has some similarities and they use the WS-* specs to drive their pipeline, so there is some precedent here. Also, I am not sure I totally buy into it, but the airport analogy helps me understand it a little better and understand the merits. Besides, EDRA is less about product and more about guidance—that’s why we give out the source code. Take what you like and toss what you don’t. Anyway, poke around and see what you think or even read the doc—it’s a better explanation of the whole pipeline approach and it’s got a lot of other good nuggets in there (at 300 pages, there’s a lot of nuggets).

You are now free to move about the cabin…

{REM – Fables of the Reconstruction} 

Comments