Hi All,
I am going through the Architecting Sustainable Applications guided path and I have come across ECS variations in the 'Core module patterns' video (in Architecture Patterns in OutSystems section). My question is when should the pub/sub through an ESB variation be used instead of the direction integration pattern?
I have read through 'Integration Patterns for Core Services Abstraction - OutSystems 11 Documentation' and haven't found the pub/sub pattern, is this pattern still relevant?TIA
Hello @Janet Duan ,
From my understanding of the guided path and based on my reading:
Direct Integration: In this approach, the communication happens directly between systems. For example, the Customer CS calls the ERP API whenever a customer is created. When a user creates a customer in the OutSystems app, the app directly calls the ERP API, such as:
POST { "name": "example", "email": "example@example.com"}
The ERP immediately returns a response like:
{ "customerId": 1, "status": "Created"}
The user instantly sees the customer ID. This approach is simpler and faster, providing low latency and real-time responses. However, it also means the systems are tightly coupled if the ERP API changes or goes down, the Customer Service module is affected directly.
ESB has the Publish/Subscribe approach. In this approach, the systems communicate through a layer, the ESB, which handles event publishing and subscribing. When a new customer is created, OutSystems publishes an event such as:
{"eventType": "CustomerCreated", "data": { "name": "example", "email": "example@example.com"}}
This message is sent to the ESB, and the ERP (along with any other interested systems that is connected to it) subscribes to that event to process it. The ERP may later send a confirmation event once it creates the record.
This model provides loose coupling, scalability (meaning you can improve it by time and not to worry about the dependencies), and asynchronous communication. It is more suitable when multiple systems need the same data or when reliability is more important than an immediate response like in large enterprises.
So to summarize direct integration offers tight coupling, low latency, synchronous processing, and simplicity like Payment Gateway which requires instant reply like payment confirmed, while the ESB model provides loose coupling, scalability, asynchronous communication, and higher resilience at the cost of added complexity and slight delay like after the payment response the bank sends you a notification on the mobile that your bank account is xxx after the last payment which is not necessarily at the very first second.