Ejemplo n.º 1
0
 public TestCommandSubscriber(IGeneralBus bus)
 {
     _bus = bus;
     TestCommand2Handled = 0;
     _bus.Subscribe <TestCommands.TestCommand2> (this);
     _bus.Subscribe <TestCommands.TestCommand3>(this);
 }
Ejemplo n.º 2
0
        public AccountSvc(IGeneralBus bus, IRepository repo)
            : base(bus)
        {
            _repo = repo;

            bus.Subscribe <CreateAccount>(this);
            bus.Subscribe <ApplyCredit>(this);
            bus.Subscribe <ApplyDebit>(this);
        }
 public void Subscribe <T>(IHandle <T> handler) where T : Message
 {
     _internalBus.Subscribe <T>(handler);
     _subscriptions.Add(
         _generalBus.Subscribe <T>(new AdHocHandler <T>(_messageQueue.Handle))
         );
 }
 public TcpOutboundMessageHandler(
     IGeneralBus messageBus,
     QueuedHandler outboundMessageQueuedHandler)
 {
     _messageBus = messageBus;
     _outboundMessageQueuedHandler = outboundMessageQueuedHandler;
     _messageBus.Subscribe(this);
 }
Ejemplo n.º 5
0
 public IDisposable Subscribe <T>(IHandle <T> handler) where T : Message
 {
     if (_idTracker != null)
     {
         throw new ArgumentException("Cannot subscribe more than one tracked handler");
     }
     if (typeof(T) != typeof(Message))
     {
         throw new ArgumentException("Only Message type subscriptions supported");
     }
     _handler   = handler;
     _idTracker = new MessageIdTracker((IHandle <Message>)handler, (g) => _trackedMessages.Add(g));
     _bus.Subscribe <Message>(_idTracker);
     return(new SubscriptionDisposer(() => { this?.Unsubscribe(handler); return Unit.Default; }));
 }
Ejemplo n.º 6
0
 public IDisposable Subscribe <T>(IHandleCommand <T> handler) where T : Command
 {
     return(_target?.Subscribe <T>(handler));
 }