orleans
orleans copied to clipboard
Stateless worker grains don't support reentrancy by predicate
You can't add the [MayInterleave]
attribute to a grain that also has the [StatelessWorker]
attribute. Doing so results in the following exception (with stack trace):
Message:
System.ArgumentException : Cannot set a component on a StatelessWorkerGrainContext
Stack Trace:
StatelessWorkerGrainContext.SetComponent[TComponent](TComponent instance) line 114
MayInterleaveConfigurator.Configure(IGrainContext context) line 415
GrainContextActivator.CreateInstance(GrainAddress address) line 62
Catalog.GetOrCreateActivation(GrainId& grainId, Dictionary`2 requestContextData, MigrationContext rehydrationContext) line 265
MessageCenter.ReceiveMessage(Message msg) line 518
The docs don't specify this isn't a possible combination of features: MayInterleave docs StatelessWorker grain docs
Either way, I don't know why stateless worker grains wouldn't be able to have reentrancy using predicates by design. It seems like a valid use case for a stateless worker grain to determine reentrancy by a RequestContext
property or something like that?