EventSourcing | .NET Core event sourcing framework | SDK library
kandi X-RAY | EventSourcing Summary
kandi X-RAY | EventSourcing Summary
A .NET Core event sourcing framework. Easy to be integrated in ASP.NET Core web application, Lambda function or Azure function.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of EventSourcing
EventSourcing Key Features
EventSourcing Examples and Code Snippets
Community Discussions
Trending Discussions on EventSourcing
QUESTION
I have a microservice in Quarkus which implementing CQRS/Event sourcing using AxonIq Framework. I Already made it using Spring boot and everythings it's ok. I would like to migrate it in Quarkus but I have error during maven compilation probably because the Ioc. When CDI try to create the service I think he can inject Axon CommandGateway and QueryGateway.
...ANSWER
Answered 2022-Feb-22 at 08:06I had the same issue, one of the reasons can be that your bean is brought by a dependency and to fix it you need to add an empty beans.xml in main/resources/META-INF in this dependency in order for Quarkus to discover the beans as indicated by the documentation
Relevant extract:
The bean archive is synthesized from:
the application classes,
dependencies that contain a beans.xml descriptor (content is ignored),
dependencies that contain a Jandex index - META-INF/jandex.idx,
dependencies referenced by quarkus.index-dependency in application.properties,
and Quarkus integration code.
QUESTION
I'm using Axon for implementation of CQRS/Event sourcing in my Vert.X microservice. In the bootstrap of my Verticle I have a createInfra methid for creation of my Axon context. When I try to get a ressource from ny projection I have no result and the request executed without end. When I check the QueryGateway, in the SimpleGatewayBus I have no subscription.
If someone can help me for fix my Axon configuration ? And I have a trouble with MongoDB Eventstore configuration.
Verticle
...ANSWER
Answered 2022-Feb-18 at 08:06I see 2 problems in the configuration:
You just "build" the configuration, but don't start it. After
buildConfiguration()
, make sure to call 'start()' on the returned Configuration instance. Alternatively, directly callstart()
on the Configurer. It returns a started configuration instance.That should resolve the registrations not coming through. But it will probably trigger an exception related to the next issue....
Your MongoTokenStore configuration is incomplete. The TokenStore needs at least a serializer and a
MongoTemplate
instance. The latter tells the Axon which collections you want to certain types of information in. In your case, only theTrackingTokenCollection
would be relant.
QUESTION
I have a CQRS/Eventsourcing architecture with 3 microservices. I implemented 2 microservices with vert.x 4 and I implemented CQRS/Eventsourcing without framework to improve my knowledge of this type of architecture. For the third microservice I would like to use AxonIq Framework but I have a problem with Aggregate annotation because it's not avalaible with vert.x but only with Spring. I implemented a Spring microservice using Axon and everything work fine but I would like to know if someone can help me for use vert.x with AxonIq ? If anyone know a workaround for this problem ?
Thank
...ANSWER
Answered 2022-Feb-15 at 11:05Axon Farmework provide something called Configuration API
. You can have a look at the Configuration class but for making use of it, you need a Configurer, which will provide you all means of configuring your components!
On the ref-guide, you also have several examples of how to do the configuration using the API or Srring Boot. Example for Commands can be found here.
To help a bit more, I can also share a small project I made using Dropwizard and Axon Framework, meaning no Spring was used and all the Configuration was done through the API. You can find it here https://github.com/lfgcampos/axon-playground/tree/master/chat-getting-started-dropwizard
QUESTION
I'm looking for options for our eventsourcing solution. I received recommendations to use Eventbridge Archive since we are already using AWS Eventbridge.
For what I found about the Archive feature, it can store all the events that we send to the eventbus and can replay them later based on a filter.
The problem is that I couldn't find a way to read data from this Archive without replaying the events.
Does anyone know if there is an API that allow me to do that?
Everything I can find on Google is about create, archive and replay, but nothing about reading data from events stored in the Archive.
I found this other question but it didn't have any answers.
...ANSWER
Answered 2022-Jan-31 at 23:17(Disclaimer: this answer is informed only by a quick skim of the Eventbridge docs)
Event sourcing is a bit of an overloaded term: it's been used to mean everything from an architecture built on exchanging events to using persisted events as the source of truth.
In the latter usage of the term (which might be called "going full event sourcing"), strictly speaking, all reads are replays of an event stream, with there being multiple event streams and the same event often being written to multiple event streams (e.g. a "cart checked out" event may well be written to an event stream for that particular cart and to an event stream consisting only of "cart checked out" events).
EventBridge and EventBridge Archive would appear to be sufficient to "go full event sourcing": each one of these event streams becomes an event bus. It might not be ergonomic to create new buses on the fly and the mechanism for publishing the same event to multiple streams may be complex (e.g. a service getting fed base events and continuously projecting them to other streams), assuming that you will have somewhat less than 100 entities (as AWS accounts are limited to 100 event buses). If you have more than 100 entities, then EventBridge isn't a fit for event sourcing.
That said, in event sourced systems it's almost universally common to have some read functionality which doesn't map well to replaying a stream (e.g. adhoc queries/aggregations over the events). This is where Command Query Responsibility Segregation comes in: it's OK if adopting CQRS to
- have multiple data models in the application
- have workloads use the data model which is the most appropriate for that workload
The command-processing/write side of an application often benefits from event sourcing (especially if there's infrastructure to help with some combination of concurrency control/caching/maintaining single-writer). You then project event streams into other data models (e.g. databases or search systems or alerting infrastructure) which can be tuned for the queries that will be performed against them.
So your question is perhaps better expressed as "how do I do CQRS in an event sourced system", and thankfully, there's a well-established body of technique for that. In your case, sending all the events in (at least some of) the streams to a Lambda which writes them to a database is likely to be a reasonable way to support CQRS.
QUESTION
I have web app with two databases:
- EventStoreDB - for events
- PostgreSQL + Marten - for projections
For subscription and add data from eventstore to postgres I use this sample sample But, when I make create operation and got success result, next I am trying load new object from postgres, postgres has not my new object.
How can I make "events applying from eventstore to postgres faster or sync" ?
...ANSWER
Answered 2022-Jan-29 at 20:19Event-sourced systems by definition have a time lag between an event being stored in an event store, and it is projected to a read model. The lag is always there unless you apply the event synchronously to an in-memory read model when you commit the event to the store. But that approach would limit you to run your service as a single instance, otherwise, you cannot be sure that the in-memory state is synchronized. There are techniques to solve that, but they are rather complex.
As you don't describe the need for you to get the read model data immediately, it's hard to give specific advice, but I have some tips.
If you need it for the UI, and the UI needs the new entity state, you can return the entity state as the command handling result, as you already have it. Then, the UI can show the state immediately without executing any queries.
Same scenario, but you return a collection of new events to the UI. If the UI bit is built with something like React and Flux, they most probably already have "event sourcing" there (that's what Flux essentially is), and applying those events via their reducers they can update the UI without querying the read model.
If you know what read model needs to be in sync (I can't say how many you have), you can propagate the event commit position to the read model as a metadata property, or just as a document property. Then, you can hold the API call (basically wait) until the read model update position property gets equal to or more than the commit position. The drawback is that you can do it for a specific read model only, so your command handler needs to know too much about the read side.
Similar to (3) but you check the checkpoint store position. If the checkpoint store is not optimized with batching, it will soon pass over the last event commit position, then you return 200 OK to the caller. It's a bit easier than (3) as it only cares about the subscription checkpoint, not the single read model, but you need access to the checkpoint store.
The UI can do the same after they get the command handled, you need to return the commit position of the last event, and they query and wait.
I've seen all of the above working in production, but my preferred solutions are (1) and (2).
To make any of those work, your command service needs to return a sophisticated result to the caller (API, or beyond) as I've done in Eventuous.
QUESTION
Still new to java and axon, having troubles to setup integration test suite using spring and axon.
Basically, I have some process, which:
- starts with command1
- goes to command handler on aggregate and event1 is dispatched
- event1 is processed by some policy (event listener) and command2 is generated
- command2 is processed by command handler service (thus has no aggregate id) because I need to process something with third party
- event2 is dispatched and processed by another event listener, so command3 is dispatched
- command3 is processed by aggregate and event3 is dispatched
I use axon tests for unit testing aggregates and it works great.
But I would like to add "integration" tests to:
- check the whole flow, like: when command1 dispatched then event1, event2, event3 is recorded (actually don't care about fields, just to have confidence the whole thing is glued as expected)
- check the service command handler work as expected in manner "when command2 dispatched, then event2 is recorded"
I was partly succesful with 1) by doing:
...ANSWER
Answered 2021-Sep-01 at 11:56The initializing command handler that receives command1 to create the aggregate might return the aggregateId, so you can fetch the returned result and use the id for future reference.
QUESTION
No instance of play.api.libs.json.Format is available for akka.actor.typed.ActorRef[org.knoldus.eventSourcing.UserState.Confirmation] in the implicit scope (Hint: if declared in the same file, make sure it's declared before)
[error] implicit val userCommand: Format[AddUserCommand] = Json.format
I am getting this error even though I have made Implicit instance of Json Format
for AddUserCommand
.
Here is my code:
...ANSWER
Answered 2021-Aug-08 at 15:55The error says that it cannot construct a Format
for AddUserCommand
because there's no Format
for ActorRef[Confirmation]
.
When using Json.format[X]
, all the members of the case class X
must have a Format
defined.
In your case, you probably don't want to define a formatter for this case class (serializing an ActorRef
doesn't make much sense) but rather build another case class with data only.
Edit: See Levi's answer on how to provide a formatter for ActorRef
if you really want to send out there the actor reference.
QUESTION
I have a code in a library for doing some kind of eventsourcing. It defines events with a given type and data for each kind of events.
I want to write a reduce function that walks through a list of events and apply them to a given initial value.
My question is how I can define the type of the reducer function eventData
parameter to match the current key? My goal is to get TypeScript to infer parameter types based on the object key so I don't have to typecast the event data parameters (i.e.: (eventData as AddEvent['data'])
).
In a nutshell: currently the wrongReducer
object leads to TypeScript errors but I want to define the Reducer
type to make it work this way.
Is there any TypeScript magic to achieve this?
...ANSWER
Answered 2021-Jul-29 at 17:31I got this to work using a bit of a creative version of key remapping:
QUESTION
I am following a basic tutorial for a project with CQRS and EventSourcing. In the source code of the full tutorial project there is only one configuration class to configure Axon framework for the project, the code is as follows:
...ANSWER
Answered 2021-Mar-12 at 20:57The com.mongodb.client.MongoClient
class is the new API and probably is not compatible with the version of Axon Framework that you are using.
To make it work you may need to downgrade your Mongo dependency (spring-boot-starter-data-mongodb
) and use the legacy API import com.mongodb.MongoClient
.
QUESTION
I have been learning about axon and event sourcing and I think I have finally understood part of it and it makes sense in my head, but I want to make sure that my understanding of it is correct and that I am not making any mistakes. The code works, and I can see the events in my DOMAIN_EVENT_ENTRY table also.
I will post my code below (simple GiftCard example from the docs) and explain my thought process. If I have not understood it correctly, please could you help me on understanding that part in the correct way.
I've not included the commands/events as they are very simple with fields for id,amount
First my code:
TestRunner.java
...ANSWER
Answered 2021-Jan-10 at 14:59yes, it looks like you are using the command gateway correctly, and the aggregates have the right methods annotated with the right stuff! You are using the Saga design pattern for Distributed Transactions which is much better than a 2PC (Two-phase commit), so each step calling the next step is the right way of doing it.
As long as the starting saga method is annotated with @StartSaga
, and the end one is annotated with @EndSaga
, then the steps will work in order, as well as rollback should work properly
The saveAndWait
function actually returns a CompletableFuture
, so if you wanted to, you can step through the threads in debug mode and pause the thread until the whole saga is complete if that's what you'd like to do.
My only concern with is is - are you using the Axon Server as the Event Sourcer, or another Event Bus or sourcer that Axon Supports? The only problem with the Standard Axon Server is that it's a Free Tier
product, and they are offering a better, more supported version like Axon Server Enterprise
(which offers more features - better for infrastructure) - so if you are doing this for a company, then they might be willing to pay for the extra support in higher tier...
Axon Framework does actually support Spring AMQP, which is useful because then, you can have better control over your own infrastructure rather than being tied down to a paid-for Axon Server
- which I don't is actually good or not.
If you can get it to work with a custom Event Bus/Sourcer, then your system will be very good - in combination with the ease of developing on Axon.
As long as the Aggregates have the right annotations on them, and you command gateway is autowired correctly, then everything should work fine. My only worry is that there isn't yet enough support for Axon Framework
yet...
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install EventSourcing
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page