WSO2 is now Choreo LabsLearn more

Trusted AI Governance
Build

Create agents and AI apps with the tools and languages your teams already use.

Connect

Link agents securely to your APIs, data, models and business systems.

Run

Deploy, observe and operate agents and AI apps reliably at any scale.

Govern

Control identity, access, cost and policy for every agent in production.

Agent Management

Developer Platform

  • API Management Cloud

    Design, secure and publish APIs with governance and analytics built in.

    Sign Up Now
  • Integration Cloud

    Connect apps, data and AI agents with low-code and pro-code integration.

    Sign Up Now
  • Identity & Access Management Cloud

    Secure sign-in and access for customers, partners, workforce and agents.

    Sign Up Now
  • Agent Management Cloud

    Build, run and govern AI agents with full visibility and control.

    Sign Up Now
  • Developer Platform Cloud

    Ship cloud-native apps faster on an internal developer platform.

    Sign Up Now

Self-Hosted

Full control over your stack. Deploy directly to your own servers, bare metal, cloud, or Kubernetes environment. Your data never leaves your perimeter.

Product Downloads
Choreo Labs
AI Governance
Platform
Solutions
Resources
Article

[Architecture blog] a pragmatic approach to the API façade pattern

Façades hide the complexity of internal implementations and provide simple interfaces. This is a common pattern in computer science but we can find it in the real world too. Lets look at a real world example first: if you walk into a shoe store you find samples displayed in a manner making them easy to pick and select, but if you walk to the back of the store you will find a massive warehouse with millions of shoes that will not provide an easy way find the correct shoe for you. What does the showroom do? It provides a façade that displays the shoes in a way that helps buyers select and buy the shoes they want, thereby reducing the complexity and enhancing the buying experience.

Similarly, façades used in computer systems hide complexity and provide a better experience for the consumers (demand).

Figure 1

Lets look at how façade patterns apply to API Management. There is a clear gap between the consumer demand for APIs and the internal services available in each enterprise. As an example, consumers look for Web APIs that can be accessed using REST principles, deliver content using JSON and be secured by OAuth addition so that the APIs can be externally accessible and discovered. This may map to an authenticated XML/SOAP based service within the enterprise.

API façade patterns mainly contain four functional layers:

  1. Backend services
  2. Mediation
  3. Façade
  4. External format / Demand

Figure 2

Most commercial API management solutions treat the mediation, façade and demand as a single functional, architecture and deployment layer.

Figure 3

If we look at the gap between backend services and the demand, can a lightweight mediation layer with limited service bindings such as HTTP/s, JMS build a business API? Are you willing to add the resulting additional wrapper service layer to maintain it?

WSO2 recommends a more pragmatic approach by recommending dividing the façade layer and mediation layer into clear functional, architecture and deployment layers.

Figure 4

This architecture can facilitate heavy mediation including service chaining/orchestration to provide a business friendly API for the consumers. This also allows one to do a clean deployment by inheriting the infrastructure policies appropriate for each layer, as well as scale each architecture layer separately.

Figure 5

Implementation of the WSO2 API Façade is facilitated by using the WSO2 API Manager to build the demand and façade layers and the WSO2 ESB to build the mediation layer (also add in products like the WSO2 Business Process Server if required) and connect to the existing services. If you are planning to write new set of backend services using standards such as JAX-WS, JAX-RS you can use the WSO2 Application Server as a runtime. In addition to that if there are any other business or technical requirements to build new business APIs you can add them with or after the mediation layer by leveraging the 17+ products in the WSO2 Middleware Platform.

This pragmatic and architecturally rich approach of WSO2 API Façade pattern results in many benefits for the API management solutions:

  • Clean architecture by separating the concerns
  • Have a clear separation of internal and external processing of an API call
  • Ability to scale based on the actual usage of each layer
  • Avoid implementing new services or building wrapper service layers
  • Leverage SOA principles with the new Web API architecture
  • Utilize the middleware and go to market quickly

Having said that if you are planning to have a single layer to facilitate all three layers of API façade, there are no technical limitations in WSO2 API Management Platform to doing that. You can build the mediation by configuring the pre-configured ESB running as the internal dispatching engine of the API gateway. However for a real-world deployment we recommend that you consider using the flexible, componentized nature of the WSO2 platform to build a clean, scalable, manageable WSO2 API Façade.