On 20.02.14 16:38, [email protected] wrote:


On Thursday, February 20, 2014 9:23:48 PM UTC+8, Martin Krasser wrote:


    On 20.02.14 14:00, Patrik Nordwall wrote:



    On Thu, Feb 20, 2014 at 1:47 PM, <[email protected]
    <javascript:>> wrote:

        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...


    I think you have a good point. I don't know how difficult it
    would be to support it,

    that's a minor addition to let ConfirmablePersistent messages
    through. OTOH, letting to (eventsourced) processors communicate
    with each other via channels smells like someone wants to extend a
    consistency boundary beyond a single actor, especially if state of
    actor A needs to be checked to conditionally update state of actor
    B and vice versa (as in the given example). In this case, both
    processors should be collapsed into a single one.


Martin, using one single eventsourced processor greatly simplifies the example, but we have scalability and performance concerns.

This doesn't mean having the whole application state in a single processor. Instead of partitioning accounts and orders, you could also partition by user, for example, keeping accounts and orders for a subset of users within a processor. See also the cluster sharding <http://doc.akka.io/docs/akka/2.3.0-RC4/contrib/cluster-sharding.html> feature of Akka. This is just a thought - I don't know the requirement details of your applications. Just wanted to mention there are multiple to achieve write scalability.


    but feel free to create a ticket and we will investigate it. The
    least we can do is to document the limitation (well, it's already
    documented in the ScalaDoc) and how to work around it.

    /Patrik



        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
        <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]
        <javascript:>.
        To post to this group, send email to [email protected]
        <javascript:>.
        Visit this group at http://groups.google.com/group/akka-user
        <http://groups.google.com/group/akka-user>.
        For more options, visit
        https://groups.google.com/groups/opt_out
        <https://groups.google.com/groups/opt_out>.




--
    Patrik Nordwall
    Typesafe <http://typesafe.com/> - Reactive apps on the JVM
    Twitter: @patriknw

-- >>>>>>>>>> Read the docs: http://akka.io/docs/
    >>>>>>>>>> Check the FAQ: http://akka.io/faq/
    >>>>>>>>>> Search the archives:
    https://groups.google.com/group/akka-user
    <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] <javascript:>.
    To post to this group, send email to [email protected]
    <javascript:>.
    Visit this group at http://groups.google.com/group/akka-user
    <http://groups.google.com/group/akka-user>.
    For more options, visit https://groups.google.com/groups/opt_out
    <https://groups.google.com/groups/opt_out>.

-- Martin Krasser

    blog:http://krasserm.blogspot.com
    code:http://github.com/krasserm
    twitter:http://twitter.com/mrt1nz


--
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.

Reply via email to