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); }); }
public void Process_transition_raises_state_events() { _processActor.Ref.Tell(MessageMetadataEnvelop.New(new BalloonCreated("1", Guid.NewGuid().ToString(), DateTime.Now, _processId), MessageMetadata.Empty)); _localAkkaEventBusTransport.Subscribe(typeof(IMessageMetadataEnvelop), TestActor); FishForMessage <MessageMetadataEnvelop>(m => m.Message is ProcessManagerCreated <TestState>); FishForMessage <MessageMetadataEnvelop>(m => m.Message is ProcessReceivedMessage <TestState>); }
public void Subscribe(Type messageType, IActorRef actor, IActorRef subscribeNotificationWaiter = null) { _local.Subscribe(messageType, actor, subscribeNotificationWaiter); _remoteSubscriber.Ask <SubscribeAck>(new Subscribe(actor, messageType, subscribeNotificationWaiter)).Wait(); }