EventStore and Application Life Cycle

This question may be silly, but I'm a little confused. Suppose we want to use this template:

  • What is an event storage area in an enterprise application?

  • Does the event store support multiple processes or is it just a concept in the process?

  • What happens to events when the application closes? Are they associated with the instance application, or with the application?

  • What is the difference between Event Storage and MessageBus with Publisher / Subscriber (part of the fact that we can store message history?

  • Who is responsible for the idempotency of the message?

  • what this sentence actually means: "Interestingly, even without the presence of distributed transactions across various resources involved, such as a message queue and persistent storage, EventStore can provide a fully transactional experience. breaking a distributed transaction into smaller parts and performing each separately" ( from this project ) I do not understand how a transaction violation is in several small pieces, even if all transactional transactions can replace a distributed transaction.
+4
source share
2 answers

What is an event storage area in an enterprise application?

An event repository is similar to a database in this sense. This is not covered by any specific application. However, it may be limited to business linguistic boundaries. For example, if you partition your system into subsystems, each subsystem can have its own instance of the event store.

Does the event store support multiple processes, or just a process concept?

This is not a process concept. It is shared between processes / applications, like a database.

What happens to events when the application closes? Are they associated with the instance application or application?

The event store will store all the events that the application asked to save. Events are associated with a thread identifier, which is usually the identifier of the aggregate root . This is not related to specific instances of the application.

What is the difference between an event repository and a MessageBus with a publisher / subscriber (part of the fact, can we keep the message history?

Keeping a message history is basically a central difference in functionality. The difference in the use case is that the message bus is used to transfer messages between endpoints, where it is used to store messages (usually events) as an event store.

Who is responsible for the idempotency of the message?

You as a developer. The event store displays events as stream-serialized data, possibly with a version. In version control, it can handle certain conflicts, but it's up to you whether the message is idempotent or not.

I cannot figure out how to crack a transaction in several pieces, even if all transactional transactions can replace a distributed transaction.

Take a look at the explanation of the saga pattern . The main idea is that instead of grouping several operations in one distributed transaction, the operation is divided into parts. If any part fails (leading to a rollback in distributed tx), an error message is sent that may allow interested parties to perform rollback operations. This can be seen as a form of compensation, and it is a more natural way to analyze many business scenarios. For example, when a payment transaction is considered invalid, it is not deleted, but a compensating transaction is added. This way of representing activity is better aligned with reality, because in reality something is rarely “canceled”.

+7
source

How many questions!

What is an event storage area in an enterprise application?

The event store is not a model, it is a method commonly used with two different (but strongly related) templates: Event Sourcing and Segmentation of responsibility of commands and requests . Being a “repository”, it’s just a way to preserve the state of a business-related application.

Both templates are often used in conjunction with the model because they work well with the templates provided by Evans in Domain Management .

EventStore allows you to save domain events (the path of the event source) or application events (aka, commands, in CQRS). It differs from the document and relational storage, because you do not save the state of the model, but the events that led to it. However, you can use either a DBMS or a db document to store events.

Then, to get the object, you can simply play each of the registered events / commands in sequence. Snapshots can be used to speed up this process.

Does the event store support multiple processes, or is it just a process concept?

It depends on the implementation of the repository, but there are no reasons preventing its use among several processes and / or applications.

What happens to events when the application closes? Are they associated with the instance application, or with the application?

Again, it depends on the implementation of the store. The simplest possible event store saves events in numbered files, so when the application terminates, the events are still there (it always reminds me of Thompson’s words: “We have persistent objects, we call them files”).
But nothing prevents you from having a volatile event repository, just in memory if your application really needs it. I would execute it as an add-only assembly, preserving the input order.

What is the difference between an event store and a MessageBus with Publisher / Subscriber (part of the fact can we keep a message history?

The message bus is a tool for delivering messages. Events (and commands) are messages, so you can use them to deliver them. The event store is instead a storage tool.

Who is responsible for the idempotency of the message?

In most common scenarios, the guy who designs the domain model. On a system other than DDD, this is the guy who develops messages (events or commands). Indeed, idempotence should be guaranteed by message recipients, not per se technology.

Given that EventStore can combine duplicate messages when they detect them. But this does not, in fact, the idempotent model.

what this sentence actually means: “Interestingly, even without the presence of distributed transactions in various resources involved, such as a message queue and persistent storage, EventStore can provide a fully transactional experience. breaking a distributed transaction into smaller parts and executing each separately” ( from this project), I can’t understand how a transaction is breached in several small parts, even if all transactional transactions can replace a distributed transaction.

It depends on the meaning that the author assigns to a "fully transactional experience." For me, this sentence does not look right, because it violates Brewer's theorem .

You can find this CQRS Journey from Microsoft and Greg Young.

See you tomorrow at the office :-)

+6
source

All Articles