コード例 #1
0
        public void Should_Be_Able_To_UnSubscribe()
        {
            var subject    = new Subject(Guid.NewGuid(), new HashSet <IActorRef>());
            var sut        = Sys.ActorOf(PubSubActor.CreateProps(subject));
            var subscriber = CreateTestActor("subscriber");
            var subscribe  = new UnSubscribe(subject.Id, subscriber);

            sut.Tell(subscribe);

            ExpectNoMsg();
        }
コード例 #2
0
        public void Should_Not_Be_Able_To_UnSubscribe_To_Wrong_Subject()
        {
            var subject    = new Subject(Guid.NewGuid(), new HashSet <IActorRef>());
            var sut        = Sys.ActorOf(PubSubActor.CreateProps(subject));
            var subscriber = CreateTestActor("subscriber");
            var message    = new UnSubscribe(Guid.NewGuid(), subscriber);

            sut.Tell(message);

            var result = ExpectMsg <ErrorMessage>();

            result.Error.ShouldBeAssignableTo(typeof(ArgumentException));
        }
コード例 #3
0
 private void OnUnSubscribe(UnSubscribe unSubscribe)
 {
     if (_mappingActors.ContainsKey(unSubscribe.Subject))
     {
         if (unSubscribe.Subscriber == null)
         {
             _mappingActors[unSubscribe.Subject].Tell(PoisonPill.Instance, Self);
             _mappingActors.Remove(unSubscribe.Subject);
         }
         else
         {
             _mappingActors[unSubscribe.Subject].Tell(unSubscribe, Self);
         }
     }
 }
コード例 #4
0
 private void OnUnSubscribe(UnSubscribe unSubscribe)
 {
     if (_subject.Id.Equals(unSubscribe.Subject))
     {
         if (unSubscribe.Subscriber == null)
         {
             _subject?.Dispose();
             Self.Tell(PoisonPill.Instance);
         }
         else
         {
             _subject.RemoveSubscriber(unSubscribe.Subscriber);
         }
     }
     else
     {
         UnhandledMessage(unSubscribe);
     }
 }
コード例 #5
0
 public Task UnSubscribeAsync(UnSubscribe unSubscription)
 {
     return(_coordinatorActor.Ask(unSubscription));
 }
コード例 #6
0
 public void UnSubscribe(UnSubscribe unSubscription, IActorRef sender = null)
 {
     _coordinatorActor.Tell(unSubscription, sender);
 }
コード例 #7
0
    public void UnSubscriber(string topicName)
    {
        UnSubscribe temp = new UnSubscribe(topicName);

        SendOpMsg(temp);
    }
コード例 #8
0
    public void UnSubscriber(string topic_name)
    {
        UnSubscribe message = new UnSubscribe(topic_name);

        Send(JsonUtility.ToJson(message));
    }