Comments (5)
Yes, it is.
The handling of commands can be done async. It can be a service call or a message sent to an actor.
For that you have to define a asyncHandler instead of a simple handler.
An asyncHandler
receives a function from Command => Future[Event]
.
Or, asyncHandler.manyEvents
which receives a function from Command => Future[List[Event]]
That way you can ask another actor to do some validation and if the answer is positive, map it to the events you need to produce.
from fun-cqrs.
Thanks for the answer. Now I see how it works. Good job!
Would be interesting to compare your impl of AR with the one from Denis Mikhaylov: https://github.com/notxcain/akka-ddd/blob/master/akka-ddd-core/src/main/scala/pl/newicom/dddd/aggregate/AggregateRootActor.scala
from fun-cqrs.
Interesting. I need to make some time to look into it.
Our main design goal was to have the aggregate behavior and protocol (commands and events) coded outside akka. Which seems to be his (or your, I see is a fork from a project of yours) approach as well.
Thanks for the link.
from fun-cqrs.
I just realized that the tell
pattern can not be used for the collaboration (with the AggregateActor as the participant / sender).
from fun-cqrs.
Indeed, the goal is to use ask
from inside a handleCommandAsync
from fun-cqrs.
Related Issues (20)
- Support for Scala 2.13 HOT 1
- Removal of `handleCommandAsync`, `tryToHandleCommand` and `manyEvents` methods
- timeout for applyCommand HOT 4
- Eventhandling idempotency possibly flawed HOT 5
- Simplifying Command and Events
- AkkaBackend: Sender doesn't get any notification in case of empty list of Events
- Make the InMemoryBackend more flexible HOT 3
- Improve error message when Aggregate is not configured HOT 1
- Support for Scala 2.12
- Upgrade EventsSourceProvider to use akka.persistence.query.EventEnvelope2 in Akka 2.4 HOT 3
- Actor is not unique exception when configuring two backends in the same actor system. HOT 2
- Replace type projections by path dependent types
- Command and Event Handlers as PartialFunction HOT 1
- RxScala dependency for 2.11 HOT 7
- PersistedOffsetAkka mechanism inefficient HOT 6
- The EventsMonitorActor is hardcoded to timeout after 10 seconds
- AggregateActor "pipeTo self" bypasses termination logic of AggregateManager HOT 3
- Future of fun-cqrs HOT 5
- Multiple aggregates per actor system? HOT 4
- Would you be willing to accept a pull request for the Projection trait to have a additional method handler when event is successfully handled? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fun-cqrs.