Example #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();
        }
Example #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));
        }
 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);
         }
     }
 }
Example #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);
     }
 }
Example #5
0
 public Task UnSubscribeAsync(UnSubscribe unSubscription)
 {
     return(_coordinatorActor.Ask(unSubscription));
 }
Example #6
0
 public void UnSubscribe(UnSubscribe unSubscription, IActorRef sender = null)
 {
     _coordinatorActor.Tell(unSubscription, sender);
 }
    public void UnSubscriber(string topicName)
    {
        UnSubscribe temp = new UnSubscribe(topicName);

        SendOpMsg(temp);
    }
Example #8
0
    public void UnSubscriber(string topic_name)
    {
        UnSubscribe message = new UnSubscribe(topic_name);

        Send(JsonUtility.ToJson(message));
    }