To create an order, we need to check balance first and if fund is insufficient, no event will be generated; To cancel an order, we need to check the order exists and is still pending.
Anyway, my point is, there might be scenarios like this where two EventsourcedProcessor might be necessary to co-exist and work together though one or two channels in between. The current limitation prevents an EventsourcedProcessor form sitting behind a PersistentChannel... On Thursday, February 20, 2014 6:17:46 PM UTC+8, Martin Krasser wrote: > > Why don't you let M2 handle createOrder and cancelOrder commands and > emit orderCreated and orderCanceled events to M1? This way you could use > EventsourcedProcessor to implement M2 and a Processor to implement M1. > > On the other hand, it's a bit difficult to give an advise here without > knowing validation, consistency and other requirements > > On 20.02.14 08:40, dong wrote: > > Martin, let me figure out a empale to make my point. > > > > Suppose my app is a trading platform, it has two memory based models - > > account balances (M1), and pending orders (M2). The > > deposit/withdraw/createOrder commands shall be handled by M1, lets say > > after processing a 'crateOrder' event, it reduced the account balance, > > and then sent a 'OrderCreated' event to M2 for updating pending order > > set. On the order hand, cancelOrder commands are handled by M2 > > directly and after an order is cancelled, M2 needs to send an event to > > M1 to increase the balance (in case an order doesn't exist, no event > > is ever persisted). > > > > In such a use case, both M1 and M2 shall be Eventsourced processors, > > and I'd like them to work together. Does this make any sense? > > -- > Martin Krasser > > blog: http://krasserm.blogspot.com > code: http://github.com/krasserm > twitter: http://twitter.com/mrt1nz > > -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: http://akka.io/faq/ >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/groups/opt_out.
