Open Closed

Communication of modules in monolith #547


User avatar
0
Denis created

My question is about communication of modules within monolith application. In case of microservices it is clear that communication perfomred via API implemented by each service and messaging. But what if I want to use all modules in monotlith application? What is way of integration? I assume that domains, for example, should not access each other... I think that there should be way to replace implementation of api client with another implementation (on startup) which calls application services directly (not via network).

For exmaple, we have indentity application and Shop application (2 microservices). Shop implements API endpoint which returns info about purchase, which contains product info, amount, price and so on (shop domain) and client full name (identity). Shop calls endpoint of Identity returning user fullname, attaches it to purchase info and returns to user. Is it correct way? Or such data consisting of data from different applications must be constructed on 3rd part of system?

  • ABP Framework version: v3.X.X
  • UI type: Angular
  • Tiered (MVC) or Identity Server Seperated (Angular): yes
  • Exception message and stack trace: no
  • Steps to reproduce the issue: no

6 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    You can use GRPC. see https://github.com/abpframework/abp-samples/tree/master/GrpcDemo

  • User Avatar
    0
    Denis created

    @liangshiwei Thanks for your reply. But it is not what I am looking for.

    In abp doc it is described that it is better to start development from monolith and when later update modules to work as microservices. We need module be able to work in monloth and as microervice.

    1. Do you have monolith->microservices migation process described somewhere?
    2. How modules communicate with each other in monolith? I assume that should be done on Application layer to compose/decompose data from different modules and event bus in domain.

    I am looking for easy way to use same module as microservice and built in monolith app.

    If it is possible, can you please show example with Blogging module?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    HI,

    ABP has a dynamic client proxy: https://docs.abp.io/en/abp/latest/API/Dynamic-CSharp-API-Clients#dynamic-c-api-client-proxies. see also: https://docs.abp.io/en/abp/latest/Microservice-Architecture

  • User Avatar
    0
    Denis created

    Sorry, but it does not look you answered on my questions. Maybe I understand that wrong. Can you please explain the way how to use 2 modules communicating with each other in monolith and use them again but as microservices (2 solutions using same modules: one as monolith, another one as microservices)? It is clear how modules communicate with each other in microservices - via API and events. But it is not clear how I can use same module (eg blogging module) in monolith. Should communication with built in module still be performed via API (monolith app accessing itself via network)?

    Maybe you have some sample project for the monolith best practice? It will help a lot.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Sorry, your question is how the modules communicate in the monolith application, right?

    I think it is no different from microservices in usage, You can still use events directly inject application services.

    See https://docs.abp.io/en/abp/latest/Distributed-Event-Bus

    • LocalDistributedEventBus is the default implementation that implements the distributed event bus to work as in-process. Yes! The default implementation works just like the local event bus, if you don't configure a real distributed provider.

    If you want to use the Application services to be injected, you only need to reference on the 'application.Contract' layer of the module

  • User Avatar
    0
    Denis created

    @liangshiwei thanks for your reply. It is I looked for

Made with ❤️ on ABP v9.1.0-preview. Updated on November 01, 2024, 05:35