Just out of curiousity: From what I understand a transaction in Orleans can span multiple actors/grains. Is this handled somehow in this implementation, or is it more a matter of crossing your fingers and hoping for the best?
As of now transactions are limited to a single stream (as they should be) writing transactionally through multiple actors is considered an anti-pattern
Seems like they’re not quite clear on the behaviour:
“By default, all of the grains that process an external
request are included within a single transaction, so that the request
executes atomically and in isolation”
Orleans transactions are atomic, consistent, isolated, and durable. During execution, a transaction sees only a single activation of each grain involved in the transaction, thus every transaction
by itself sees a consistent application state. This state is isolated from changes made by concurrently executing transactions.
A transaction’s
updates to durable storage, even if they occur in multiple grains, become visible atomically to subsequent transactions when the transaction completes; so another transaction sees the
entire, consistent set of changes from a completed transaction. **Updates across many grains are atomically committed to durable storage, providing a consistent mechanism for persisting the result of a computation. **
Current Storage Provider API has no notion of the transaction.
As others stated before cross-actor transactions are not the best ideas, especially since the actors may be running in separate silos (physical nodes) and we’re back to DTC world of pain and misery.
I wouldn’t dismiss it that quickly.
I have a feeling after talking to some guys during London Azure User group that you may see Orleans tab in Azure portal one day…
Yes, I’m fully aware of the target platform, and I’m very intrested in actor model. I just don’t like the approach they’ve taken, excplicit message passing usually turns out a lot cleaner than trying to mimic local method calls across the network, in my experience… But I guess you could program in that style yourself, on top of the framework.
Yes, you can do it on top of it. But it’s quite involved
In fact, nothing stopping you to have actor methods which simply
accept a single message parameter.
Even polymorphic dispatch works out of the box. So you can have a
higher-order function which accepts some base Message interface.
And then dispatch internally (inside actor) to a more specific
handler by using “dynamic”.
But you'll still need to obtain a reference to an actor by using
some obnoxious static factory, codegened by Orleans MSBuild target.
That’s really ugly and not unit-test friendly, at all.
To overcome this, framework need to do some form of DI.
I hope they fix this in the next release, given we have provided a
lot of feedback on this.
I did some work on message bus for Orleans, and it's started
breezing but still in flux.
I hope to combine Orleans.Bus with Orleans.EventSourcing to have
Orleans.CQRS soon
Orleans.EventSourcing will be even more compelling with sharding.
I think there can be some specific stuff done with Orleans to make it better by getting close to orleans from a ges perspective similar to akka stuff in the jvm api