public void GrainID_AsGuid() { string guidString = "0699605f-884d-4343-9977-f40a39ab7b2b"; Guid grainIdGuid = Guid.Parse(guidString); GrainId grainId = GrainId.GetGrainIdForTesting(grainIdGuid); //string grainIdToKeyString = grainId.ToKeyString(); string grainIdToFullString = grainId.ToFullString(); string grainIdToGuidString = GrainIdToGuidString(grainId); string grainIdKeyString = grainId.Key.ToString(); output.WriteLine("Guid={0}", grainIdGuid); output.WriteLine("GrainId={0}", grainId); //output.WriteLine("GrainId.ToKeyString={0}", grainIdToKeyString); output.WriteLine("GrainId.Key.ToString={0}", grainIdKeyString); output.WriteLine("GrainIdToGuidString={0}", grainIdToGuidString); output.WriteLine("GrainId.ToFullString={0}", grainIdToFullString); // Equal: Public APIs //Assert.Equal(guidString, grainIdToKeyString); // GrainId.ToKeyString Assert.Equal(guidString, grainIdToGuidString); // GrainIdToGuidString // Equal: Internal APIs Assert.Equal(grainIdGuid, grainId.GetPrimaryKey()); // GetPrimaryKey Guid // NOT-Equal: Internal APIs Assert.NotEqual(guidString, grainIdKeyString); // GrainId.Key.ToString }
public GuidId CreateSubscriptionId(IAddressable requesterAddress, StreamId streamId) { GrainId grainId = GrainExtensions.GetGrainId(requesterAddress); // If there is an implicit subscription setup for the provided grain on this provided stream, subscription should match the stream Id. // If there is no implicit subscription setup, generate new random unique subscriptionId. // TODO: Replace subscription id with statically generated subscriptionId instead of getting it from the streamId. return(implicitPubSub.IsImplicitSubscriber(grainId, streamId) ? GuidId.GetGuidId(grainId.GetPrimaryKey()) : GuidId.GetNewGuidId()); }
private void OnCollectActivation(GrainId grainId) { int other = grainId.GetTypeCode(); int self = Data.Address.Grain.GetTypeCode(); if (other == self) { IBusyActivationGcTestGrain1 g = GrainFactory.GetGrain<IBusyActivationGcTestGrain1>(grainId.GetPrimaryKey()); for (int i = 0; i < burstCount; ++i) { g.Delay(TimeSpan.FromMilliseconds(10)).Ignore(); } } }
private void OnCollectActivation(GrainId grainId) { int other = grainId.GetTypeCode(); int self = Data.Address.Grain.GetTypeCode(); if (other == self) { IBusyActivationGcTestGrain1 g = GrainFactory.GetGrain <IBusyActivationGcTestGrain1>(grainId.GetPrimaryKey()); for (int i = 0; i < burstCount; ++i) { g.Delay(TimeSpan.FromMilliseconds(10)).Ignore(); } } }