Skip to content

Commit

Permalink
the image link was not good
Browse files Browse the repository at this point in the history
  • Loading branch information
arnolanglade committed Dec 4, 2024
1 parent 2a1d6cd commit 9bea397
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions content/blog/command-bus-design-pattern/index.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ tags: [command-bus, design-patterns, software-architecture]

Let’s start with the basics, what is a bus? In computer science, a bus is a system that connects several components and transfers data between them. In software, those components are called middleware. A middleware processes an incoming request and returns a response. As you can see in the schema below, the main advantage of a bus is that it is highly customizable as you can add as many middleware as you want.

{{< image src="bus.svg" alt="A bus" >}}
{{< image src="bus.png" alt="A bus" >}}

In the next sections, we will speak about the command bus which is often associated with an event bus. Using an event bus is not mandatory but we will see how it will make your application more modular and evolutive. Their goal is to deliver a command or an event to their handler(s). Events and commands are objects used to encapsulate information needed to achieve an action (a command) or to tell what happened in the system (an event).

Expand All @@ -29,7 +29,7 @@ In the next sections, we will speak about the command bus which is often associa

Now, we will build a command bus following the same architecture that I described in the previous section. The only difference is that the command bus will return void. As commands canmight be handled asynchronously, we don’t want to wait for the result of the command processing.

{{< image src="command-bus.svg" alt="A command bus" >}}
{{< image src="command-bus.png" alt="A command bus" >}}

Let’s see the most common middleware used to build a command bus. The first one is probably the “logging middleware”. It helps to make your application observable and it is really useful for bug hunting.

Expand All @@ -53,7 +53,7 @@ We also don't need the transactional middleware because the event will be proces

As I said previously, events are recorded by aggregates and they should be business oriented. I will share with you two ways to dispatch events into the event bus.

{{< image src="event-bus.svg" alt="A event bus" >}}
{{< image src="event-bus.png" alt="A event bus" >}}

**Solution 1:** You can collect them from your repository if no errors have been raised during the aggregate persisting and then dispatch them.

Expand Down

0 comments on commit 9bea397

Please sign in to comment.