img
Home > Candidate Patterns > Code On Demand

Code On Demand

img

How can service consumers be extended or customized at runtime without being upgraded?

Problem

Existing service consumers may not be capable of taking advantage of new features when a service contract changes. Also, when using a reusable contract, service consumers may be implemented too generally to sufficiently reflect the individual service's requirements and capabilities. When service consumers cannot be upgraded, services may be prevented from effectively evolving.

Solution

Include implementation logic within service capability response messages, and execute this logic within the service consumer.

Application

Service consumers are equipped with a virtual machine for running the logic supplied by the service at runtime. The consumer downloads this logic by invoking service capabilities, and executes it locally.

The virtual machine must itself provide capabilities sufficient to implement useful logic. This includes support for consumer-side processing, the ability to invoke new or specialized service capabilities, and may also include features such as supporting local storage of data and/or supporting user interaction.

Impacts

Processing effort is further decentralized. Execution occurs in service consumers rather than in services, increasing scalability.

Custom capability invocation is less able to be understood by common network intermediaries than between the service provider and service consumer. Firewalls and caches alike may be unable to perform their usual function.

Executing service logic can significantly increase the area of attack within service consumers for security vulnerabilities.

Architecture

Inventory, Composition, Service

Status

Under Review

Contributors

Raj Balasubramanian, Benjamin Carlyle, Cesare Pautasso
img

Service consumers are extended with additional deferred service logic. Embedding a common virtual machine within service consumers allows their functionality to be extended at runtime. Services can off-load state and processing to consumers, instruct consumers at runtime on how to interact with an extended service contract, and also provide interactions with the underlying hardware and with human users.

Related Patterns in This Catalog

Lightweight Endpoint, Partial State Deferral, Reusable Contract

Related Service-Oriented Computing Goals

Increased Organizational Agility, Reduced IT Burden