Sunday, May 29, 2022

Restful Services


https://www.edureka.co/blog/microservices-design-patterns

Design Steps
  • Identify object model
  • Create Model URIs
  • Determine Representations
  • Assign HTTP Methods

JAX-RS 2.0 (Java API for RESTful Services).
JAX-RS stands for JAVA API for RESTful Web Services

From <https://www.tutorialspoint.com/restful/restful_jax_rs.htm>


From <https://restfulapi.net/create-rest-apis-with-jax-rs-2-0/>

Caching
Has the following attributes in the header
  • Date
  • Last Modified
  • Cache Control - Public, Private, no-cache/no-store, max-age, must-revalidate
  • Expires
  • Age

  1. Scope microservices using Bounded Context
    1. Domain Driven Design- Bounded Context
    2. Ubiquitous Language
  2. N+1 problem - https://restfulapi.net/rest-api-n-1-problem/
  3. Asynchronous Web Services - Event Based
    1. Competing Worker Pattern
    2. Fanout Pattern
    3. Async API Call
  4. Architecture of API Based Microservice
    1. Functional Requirement
      1. Loosely coupled
      2. Independently changeable
      3. Independently deployable
      4. Support and honor contracts
      5. Technology Agnostic
      6. Stateless API
    2. API Architectural Styles
      1. Basic REST Implementation
        1. Following the rest constraints
        2. HTTP Protocol is followed
        3. Inherits the advantages of the Web
        4. Uses JSON/XML to send and receive data
        5. Uses Resource End point to communicate
        6. Uniform Resource Identifier
        7. Stateless
        8. Cacheable
        9. Example
      2. Pragmatic REST
        1. Not all resources would do CRUD Operation
        2. Some resources takes actions/Task
        3. Name these resources as Verbs instead of nouns
      3. HATEOAS REST
      4. RPC
      5. SOAP
    3. API Architectural Pattern
      1. Façade Pattern
      2. Proxy Pattern
      3. Stateless service pattern
      1. No State information maintained on server
      2. Clients maintain state
      3. State is send as part of the request
      4. Advantages: Help in scalability, performance and availability
  1. Composing Microservices
    1. Composition Patterns
      1. Broker Composition Pattern
      2. Aggregate Composition Pattern
      3. Chained Composition Pattern
      4. Proxy Composition Pattern
      5. Branch Composition Pattern

Data Consistency
  1. Two Phase Commit
  2. Saga Pattern-Saga Execution Coordinator
  1. Eventual Consistency : Eventually the Data would be consistent across the systems. It is a practice rather than pattern. It chooses Availability over Consistency.

API Gateway




Open Source API Gateway

No comments:

Post a Comment