public EventBusForwarder(IActorTransport localTransport)
 {
     _localTransport = localTransport;
     Receive <Publish>(p =>
     {
         _localTransport.Publish(p.Msg);
         Sender.Tell(PublishAck.Instance);
     });
     Receive <PublishMany>(p =>
     {
         var messages = p.Messages.Select(m => m.Msg).ToArray();
         _localTransport.Publish(messages);
         Sender.Tell(PublishManyAck.Instance);
     });
     Receive <Subscribe>(s =>
     {
         _localTransport.Subscribe(s.Topic, s.Actor, s.Notificator);
         Sender.Tell(SubscribeAck.Instance);
     });
     Receive <Unsubscribe>(us =>
     {
         _localTransport.Unsubscribe(us.Actor, us.Topic);
         Sender.Tell(UnsubscribeAck.Instance);
     });
 }
Exemple #2
0
 public void Unsubscribe(IActorRef actor, Type topic)
 {
     _local.Unsubscribe(actor, topic);
     _remoteSubscriber.Ask <UnsubscribeAck>(new Unsubscribe(actor, topic), _timeout).Wait();
 }