Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
rheactor-event-store
Advanced tools
Readme
Implementation of an event store based on redis.
Contains helper methods to manage secondary indices.
Storing events per aggregate is done in a list per individual aggregate, the order of the insertion is guaranteed by using Redis lists. This gives use an version number per event for free.
Lets assume we want to create a user 17
, we store a UserCreatedEvent
for this aggregate id:
eventStore.persist(new ModelEvent('UserCreatedEvent', '17', {name: 'John'}))
If we add another event later:
eventStore.persist(new ModelEvent('UserNameUpdatedEvent', '17', {name: 'Mike'}))
this event will be appended to the list.
When aggregating the events, we can increase the version of the aggregate per event.
The initial implementation of the event store modified models in place. More recently we decied to use immutable models instead.
The ImmutableAggregateRepository
changes how Models are instantiated. It moves the responsibility of creating the model instance to the repository, where the applyEvent()
method is invoked as a reducer. The method will return an instance of ImmutableAggregateRoot
which can no longer be manipulated directly.
This also changes how meta information is stored in the Aggregates, it is now encapsuled in a separate object called AggregateMeta
.
See the tests for details.
FAQs
Implementation of an event store based on redis
The npm package rheactor-event-store receives a total of 19 weekly downloads. As such, rheactor-event-store popularity was classified as not popular.
We found that rheactor-event-store demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.