AxonBank | Simple virtual bank application to showcase features | Learning library
kandi X-RAY | AxonBank Summary
kandi X-RAY | AxonBank Summary
Simple virtual bank application to showcase features of Axon Framework
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Handles a bank transfer created event
- Marks bank transfer completed event
- Handler for marking a Source BankAccount rejected event
- Handler for Credit Destination AccountDebitEvent
- Handler for marking bank account transfer failed
- Marks the destination bank account
- Saves a bank transfer entry
- Handle bank transfer failed event
- Handle bank transfer completed event
- Handles BankAccount creation event
- Handles a Money subtraction event
- Handle a money added event
- Handle DEBITSource command
- Handle a credit destination command
- Sets deposit
- Register websocket endpoints
- Configures a simple command bus
- The Saga Manager is managing the Saga Manager
- The command handler for the bank account
- The main entry point
- Fetches all bank transfers for a bank account
- Handles a withdraw
- Gets the bank transfer entry
- Create a new bank account
- Configures the message broker
- Create a bank transfer
- Find all bank accounts
AxonBank Key Features
AxonBank Examples and Code Snippets
Community Discussions
Trending Discussions on AxonBank
QUESTION
I've read the Axon documentation and looked at all provided sample projects, especially the AxonBank which I'm referencing here, but one thing is still bothering me and is not explained as far as I see:
It is my understanding that in Axon you perform queries against a read database which represents the materialized view, e.g. a H2 that contains the latest BankAccount
JPA entity (here). However if you have a Spring repository, e.g. JpaRepository
(here), you also have the save
-method which should only be used for commands. Shouldn't you split the repository into a read-only and write-only repository?
Could someone also point me the documentation what how Axon works with this repository? Because for an unitiated developer it looks like a "normal" JPA repository, i.e. the entity seems mutable and always up to date.
But from a theoretical perspective I expect an immutable entity in a zero state where a projection is created by applying all events, does this happen in the background with Axon?
What would happen if I update the entity with JpaRepository#save
but not the aggregate? Will they be out of sync?
It seems that we have two sources of truth in this case, which shouldn't be the case theoretically.
...ANSWER
Answered 2020-May-27 at 17:47let me try to help you!
What you are describing is the CQRS pattern - especially the Query side!
The Repository you mentioned is usually used on the @EventHandler
s to build your projections, which will store the data the way you need it!
Looking at the AxonBank, it should be clearly visible here.
I don't think there is anything on Axon documentation specific about it but indeed this is a regular JPA Repository. Of course you can use whatever you want as your Query side.
What would happen if I update the entity with
JpaRepository#save
but not the aggregate? Will they be out of sync?
In this case, your view model will be updated based on anything other than events, which is not what you want. This repository should be updated only based on events, which most of the time, are sent by your Aggregates!
It seems that we have two sources of truth in this case, which shouldn't be the case theoretically.
Regarding your question about the source of truth, your Events should always be the source of truth. In the end, you should not update the repository other than using @EventHandler
s.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install AxonBank
You can use AxonBank like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the AxonBank component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
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