Esempio n. 1
0
        public GrainReference CreateObjectReference(IAddressable obj, IGrainMethodInvoker invoker)
        {
            if (obj is GrainReference)
            {
                throw new ArgumentException("Argument obj is already a grain reference.", nameof(obj));
            }

            if (obj is Grain)
            {
                throw new ArgumentException("Argument must not be a grain class.", nameof(obj));
            }

            var            observerId = ObserverGrainId.Create(this.clientId);
            GrainReference reference  = GrainReference.NewObserverGrainReference(observerId, this.GrainReferenceRuntime);

            if (!localObjects.TryRegister(obj, observerId, invoker))
            {
                throw new ArgumentException($"Failed to add new observer {reference} to localObjects collection.", "reference");
            }
            return(reference);
        }
Esempio n. 2
0
        internal static IClientGatewayObserver GetObserver(IInternalGrainFactory grainFactory, ClientGrainId clientId)
        {
            var observerId = ObserverGrainId.Create(clientId, ScopedId);

            return(grainFactory.GetGrain <IClientGatewayObserver>(observerId.GrainId));
        }
Esempio n. 3
0
 internal override ObserverGrainId GetObserverGrainId(ClientGrainId clientId) => ObserverGrainId.Create(clientId, ScopedId);