event-sourcing

Event-sourcing: when (and not) should I use Message Queue?

自古美人都是妖i 提交于 2019-12-03 10:42:49
问题 I am building a project from scratch using event-sourcing with Java and Cassandra. My apps we be based on microservices and in some use cases information will be processed asynchronously. I was wondering what part a Message Queue (such as Rabbit, Active MQ Artemis, Kafka, etc) would play to improve the technology stack in this environment and if I understand the scenarios if I won't use it. 回答1: I would start with separating messaging infrastructure like RabbitMQ from event streaming/storing

CQRS (event sourcing): Projections with multiple aggregates

家住魔仙堡 提交于 2019-12-03 08:06:06
I have a question regarding projections involving multiple aggregates on a CQRS architecture. For example sake, suppose I have two aggregates WorkItem and Developer and that the following events happen sequentially (but not immediately) WorkItemCreated (workItemId) WorkItemTitleChanged (workItemId, title) DeveloperCreated (developerId) DeveloperNameChanged (developerId, name) WorkItemAssigned (workitemId, DeveloperId) I wish to create a projection which is as "inner join" of developer-workitem: | WorkItemId | DeveloperId | Title | DeveloperName | ... | |------------|-------------|--------|----

Relational database schema for event sourcing

自作多情 提交于 2019-12-03 07:31:27
I am trying to store domain events in a postgres database. I am not sure in many things, and I don't want to redesign this structure later, so I am seeking for guidance from people who have experience with event sourcing. I have currently the following table: domain events version - or event id, integer sequence, helps to maintain order by replays type - event type, probably classname with namespace aggregate - aggregate id, probably random string for each aggregate timestamp - when the event occured promoter - the promoter of the event, probably user id details - json encoded data about the

User Auth in EventSourcing applications

徘徊边缘 提交于 2019-12-03 07:14:15
问题 I'm looking into crafting an app with DDD+CQRS+EventSourcing, and I have some trouble figuring out how to do user auth. Users are intrinsically part of my domain, as they are responsible for clients. I'm using ASP.NET MVC 4, and I was looking to just use the SimpleMembership. Since logging in and authorising users is a synchronous operation, how is this tackled in an eventually consistent architecture? Will I have to roll my own auth system where I keep denormalized auth tables on the read

CQRS without Event Sourcing - what are the drawbacks?

强颜欢笑 提交于 2019-12-03 03:34:02
问题 Besides missing some of the benefits of Event Sourcing, are there any other drawbacks to adapting an existing architecture to CQRS without the Event Sourcing piece? I'm working on large application and the developers should be able to handle separating the existing architecture into Commands and Queries over the next few months, but asking them to also add in the Event Sourcing at this stage would be a HUGE problem from a resourcing perspective. Am I committing sacrilege by not including

Event Sourcing and Read Model generation

只愿长相守 提交于 2019-12-03 02:20:35
问题 Assuming Stack Overflow domain problem and the following definition of events: UserRegistered(UserId, Name, Email) UserNameChanged(UserId, Name) QuestionAsked(UserId, QuestionId, Title, Question) Assuming the following state of event store (in the order of appearance): 1) UserRegistered(1, "John", "john@gmail.com") 2) UserNameChanged(1, "SuperJohn") 3) UserNameChanged(1, "John007") 4) QuestionAsked(1, 1, "Help!", "Please!") Assuming the following denormalized read model for questions listing

Event Sourcing: Events that trigger others & rebuilding state

怎甘沉沦 提交于 2019-12-02 23:29:18
I'm struggling to get my head around what should happen when rebuilding the model by replaying events from the EventStore, in particular when events may trigger other events to happen. For example, a user who has made 10 purchases should be promoted to a preferred customer and receive an email offering them certain promotions. We clearly don't want the email to be sent every time we rebuild the model for that user, but how do we stop this from happening when we replay our 10th PurchaseMadeEvent ? Events chaining can be very tricky and easily run out of control, so I'd avoid it as much as

CQRS Event Sourcing: Validate UserName uniqueness

醉酒当歌 提交于 2019-12-02 13:52:15
Let's take a simple "Account Registration" example, here is the flow: User visit website Click "Register" button and fill form, click "Save" button MVC Controller: Validate UserName uniqueness by reading from ReadModel RegisterCommand: Validate UserName uniqueness again (here is the question) Of course, we can validate UserName uniqueness by reading from ReadModel in MVC controller to improve performance and user experience. However, we still need to validate the uniqueness again in RegisterCommand , and obviously, we should NOT access ReadModel in Commands. If we do not use Event Sourcing, we

How can I upsert a record and array element at the same time?

て烟熏妆下的殇ゞ 提交于 2019-12-02 07:15:23
That is meant to be read as a dual upsert operation, upsert the document then the array element. So MongoDB is a denormalized store for me (we're event sourced) and one of the things I'm trying to deal with is the concurrent nature of that. The problem is this: Events can come in out of order, so each update to the database need to be an upsert. I need to be able to not only upsert the parent document but an element in an array property of that document. For example: If the document doesn't exist, create it. All events in this stream have the document's ID but only part of the information

How can I upsert a record and array element at the same time?

大城市里の小女人 提交于 2019-12-02 06:38:51
问题 That is meant to be read as a dual upsert operation, upsert the document then the array element. So MongoDB is a denormalized store for me (we're event sourced) and one of the things I'm trying to deal with is the concurrent nature of that. The problem is this: Events can come in out of order, so each update to the database need to be an upsert. I need to be able to not only upsert the parent document but an element in an array property of that document. For example: If the document doesn't