Friday, April 11, 2014


Reading Notes from "SOA Patterns" by Arnon Rotem-Gal-Oz

Chapter 2 - Foundation Structural Patterns

  • Service Host:  Make your services adaptable to different configurations easily and save yourself the repetitive and mundane tasks of setting listeners, wiring components, and so on.  Examples - the application server itself and frameworks like Spring.  App Fabric from Microsoft.  How can you easily configure services and avoid duplicating mundane tasks, such as setting listeners and wiring components, for each service?  Create a common service host component or framework that acts as a container for services. This container should be configurable and will perform the wiring and setup of services.  Service Host is a container for a service, and it performs the wiring and configuration on the service’s behalf.
  • Active Service:  Increase service autonomy and handle temporal concerns.With the Active Service pattern, you add independent behavior to a service in its own thread of control. This pattern can be used to handle recurring events, such as timeouts and monitoring.  How can you increase service autonomy and handle temporal concerns?  Make the service an active service by implementing at least one active class, either on the edge, within the service, or both. Let the active class take care of temporal concerns and autonomy issues.
  • Transactional Service:  Handle messages reliably.  Apply the Transactional Service pattern to handle the entire message flow, so that everything from receiving a request message to sending out a response is contained in a single transaction.  The Transactional Service pattern creates a transaction envelope: it opens a transaction, reads the request, handles the message, sends the response, and closes the transaction.  How can a service handle requests reliably?  Apply the Transactional Service pattern to handle the entire message flow, so that everything from receiving a request message to sending out a response is contained in a single transaction.
  • Workflodize:  Increase the service’s adaptability to changing business processes.  How can you increase a service’s adaptability to changing business processes?  Introduce a workflow engine within the service to handle the volatile and changing processes and orchestrate the stable logic.  The business process is made of the small building blocks that are relatively easy to rearrange. The workflow drives the business logic. The advantage of using workflows is that they give you a tool that makes you think in terms of building blocks (called activities) and lets you arrange and rearrange these activities into processes in a very flexible way.  The natural technology mapping for the Workflodize pattern is the use of a workflow engine. There are many workflow engines on the market,
  • Edge Component:  Allow the service’s business aspects, technological concerns, and other cross-cutting concerns to evolve at their own pace, independently of one another.  How can you allow the service’s business aspects, technological concerns, and other cross-cutting concerns to evolve at their own pace, independently of one another?  Add an edge component to the service implementation to add flexibility and separate the business logic from other concerns (such as contacts, protocols, technology choices, and additional cross-cutting features).  In a sense, the Edge Component pattern provides a façade, or proxy, to a service implementation.  An Edge Component pattern implementation that processes incoming messages in three steps—validation, transformation, and routing—before the messages are sent to the service implementation.  As a request is received, it goes through different steps like logging, validating parameters, and validating intent and the user before it gets to the business services on the right side of this figure—getting the last order or all the orders for a specific client.  As contracts evolve, the services should be able to support consumers using older versions of the contract.

Summary
  • Service Host—A common wrapper that hosts service instances and introduces a common infrastructure that can be reused across services
  • Active Service—Implements at least one independent thread in the service so it can safely call external services
  • Transactional Service—Handles messages inside a transaction to gracefully recover from error conditions
  • Workflodize—Adds a workflow inside the service for added flexibility
  • Edge Component—Separates the interface (contract) from the implementation to enable flexibility and maintainability