The middleware pattern

design-patternsmiddlewarepatterns-and-practices

Here's a Ruby poject that implements the middleware pattern. From the description, I have no idea what the pattern is, what it's useful for, and why other solutions wouldn't work as well.

What is the middleware pattern, and what are its advantages and drawbacks?

Best Answer

Of course, the term middleware has changed quite a bit since this question has been posted (almost 5 years ago at the time I am writing this).

While reading the recently published book, Building Microservices With ASP.NET Core (by Kevin Hoffman) I came upon this term and wanted to know more about it.

That lead me to the Microsoft site which now defines it in the following way:

What is middleware?

Middleware is software that's assembled into an application pipeline to handle requests and responses. Each component:

  • Chooses whether to pass the request to the next component in the pipeline.
  • Can perform work before and after the next component in the pipeline is invoked.

The middleware pattern is often used as a way to describe how message routing is handled in a microservices system. Somewhat as a central Controller which decides which microservice will receive the incoming message. In this way it is a "middleware component" which handles message routing.

Related Topic