Skip to content

Latest commit

 

History

History
84 lines (48 loc) · 5.79 KB

File metadata and controls

84 lines (48 loc) · 5.79 KB
graph LR
    ClientProxy["ClientProxy"]
    ClientProxyFactory["ClientProxyFactory"]
    ClientTCP["ClientTCP"]
    ClientNats["ClientNats"]
    ClientGrpcProxy["ClientGrpcProxy"]
    Concrete_Microservice_Clients["Concrete Microservice Clients"]
    ClientTCP -- "implements" --> ClientProxy
    ClientNats -- "implements" --> ClientProxy
    ClientGrpcProxy -- "implements" --> ClientProxy
    Concrete_Microservice_Clients -- "implements" --> ClientProxy
    ClientProxyFactory -- "creates" --> ClientTCP
    ClientProxyFactory -- "creates" --> ClientNats
    ClientProxyFactory -- "creates" --> ClientGrpcProxy
    ClientProxyFactory -- "creates" --> Concrete_Microservice_Clients
Loading

CodeBoardingDemoContact

Details

The microservices client architecture is built upon a flexible and extensible design centered around the ClientProxy abstraction. This abstract component defines the universal contract for interacting with remote microservices, enabling a consistent API regardless of the underlying transport protocol. The ClientProxyFactory serves as the primary entry point for client instantiation, dynamically selecting and configuring specific client implementations such as ClientTCP, ClientNats, ClientGrpcProxy, and other Concrete Microservice Clients (e.g., ClientRedis, ClientKafka, ClientMqtt, ClientRMQ). This factory pattern centralizes client creation logic and promotes loose coupling between the application and the specific communication protocols. Each concrete client handles the intricate details of its respective protocol, ensuring efficient and reliable message exchange. This modular approach allows for easy integration of new communication methods and simplifies the overall management of microservice interactions.

ClientProxy

This is the foundational abstract component that defines the contract for all microservice clients. It provides a unified interface for sending messages (send) and dispatching events (emit) to remote microservices, abstracting away the complexities of specific transport protocols. It also manages the lifecycle of connections and the observation of responses.

Related Classes/Methods:

ClientProxyFactory

This component is responsible for creating and configuring instances of concrete ClientProxy implementations. It centralizes the logic for instantiating the correct client based on the application's configuration (e.g., TCP, NATS, Redis, gRPC). It also integrates with the application's lifecycle hooks to ensure proper client shutdown.

Related Classes/Methods:

ClientTCP

A concrete implementation of ClientProxy that manages TCP socket connections for sending and receiving data. It handles the low-level details of TCP communication, including connection establishment, data serialization/deserialization, and error handling.

Related Classes/Methods:

ClientNats

A concrete implementation of ClientProxy that handles communication via the NATS messaging system. It integrates with the NATS client library to publish messages and subscribe to responses, leveraging NATS's high-performance messaging capabilities.

Related Classes/Methods:

ClientGrpcProxy

A concrete implementation of ClientProxy that facilitates communication with gRPC services. It includes logic for loading .proto definitions, generating client stubs, and managing gRPC channels for efficient remote procedure calls.

Related Classes/Methods:

Concrete Microservice Clients

This conceptual component represents all other specific transport client implementations (e.g., ClientRedis, ClientKafka, ClientMqtt, ClientRMQ). Each of these classes extends ClientProxy and provides the necessary logic to interact with their respective messaging systems or protocols.

Related Classes/Methods: