Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are middleware apps required to do business logic?

Let's suppose I have a large middleware infrastructure mediating requests between several business components (customer applications, network, payments, etc). The middleware stack is responsible for orchestration, routing, transformation and other stuff (similar to the Enterprise Integration Patterns book by Gregor Hohpe).

My question is: is it good design to put some business logic on the middleware?

Let's say my app A requests some customer data from the middleware. But in order to get this data, I have to supply customer id and some other parameter. The fetching of this parameter should be done by the requesting app or is the middleware responsible for 'facilitating' and providing an interface that receives customer ids and internally fetches the other parameter?

I realize this is not a simple question (because of the definition of business logic), but I was wondering if it is a general approach or some guidelines.

like image 217
Miguel Ping Avatar asked Apr 23 '09 10:04

Miguel Ping


People also ask

What is middleware business logic?

Middleware is software that enables one or more kinds of communication or connectivity between two or more applications or application components in a distributed network.

Why is middleware needed?

Middleware helps developers build applications more efficiently. It acts like the connective tissue between applications, data, and users. For organizations with multi-cloud and containerized environments, middleware can make it cost-effective to develop and run applications at scale.

What is the difference between business logic and application logic?

Business logic refers to the rules and procedures that govern a business, including things like pricing, discounts, inventory levels, customer eligibility, etc. Application logic, on the other hand, is the code that implements those business rules within a specific application.

Is business logic the same as backend?

Business Logic: It deals with the security of your application (Authentication and Authorisation) and the actual data. This is the backend of your app. Business logic should never appear in your front end because your front ends can be multiple(viz.


2 Answers

Apart from the routing, transformation and orchestration, performance should be kept in mind while loading middleware with functional requirements. Middlware should take a fraction of the entire end-to-end transaction life time. This can be achieved only by concentrating on the middleware core functionalities, rather than trying to complement the host system functionalities.

like image 149
Arul Avatar answered Sep 28 '22 00:09

Arul


This is the "Composite Application" pattern; the heart of a Service Oriented Architecture. That's what the ESB vendors are selling: a way to put additional business logic somewhere that creates a composite application out of existing applications.

This is not simple because your composite application is not just routing. It's a proper new composite transaction layered on top of the routing.

Hint. Look at getting a good ESB before going too much further. This rapidly gets out of control and having some additional support is helpful. Even if you don't buy something like Sun's JCAPS or Open ESB, you'll be happy you learned what it does and how they organize complex composite applications.

like image 29
S.Lott Avatar answered Sep 28 '22 00:09

S.Lott