Skip to content

Core Application Logic

Wuyi Chen edited this page Jun 25, 2019 · 7 revisions

Architecture

Application Logic (Cache-Aside Pattern)

Licensing Service

  • When a client makes a call to the licensing service for getting a license record associated with the organization record:
    • If the client type is "feign", the licensing service will make a call to organization service for retrieving the organization record directly.
    • If the client type is "discovery", the licensing service will make a call to organization service for retrieving the organization record directly.
    • If the client type is "rest":
      • Check Redis to see the matched organization record already cached or not:
        • If it cached, retrieve the matched record from Redis directly.
        • If it is not cached:
          • Make a call to the organization service to retrieve the matched organization record.
          • Cache the matched organization record into Redis.
  • When the licensing service gets a new message from the Kafka message queue:
    • Delete the organization record cached in Redis by the organization ID (because of a client updated an organization record, so the corresponding organization record cached in Redis is out of date. We need to delete that record from Redis so that the licensing service will get the organization record next time).

Organization Service

  • When a client makes a call to the organization service for modifying (add, update or delete) an organization record:
    • Insert a new message into the Kafka message queue to notify the licensing service that there is an update for the organization record.

Data Model

  • There are 2 types of records:
    • License
    • Organization
  • One or multiple licenses can belong to one organization.
Clone this wiki locally