Esempio n. 1
0
        public SubscriptionRouterService(IServiceBus bus, string network)
        {
            _peerUri = bus.ControlBus.Endpoint.Address.Uri;

            _network = network;

            _peerId = NewId.NextGuid();

            _observers = new List <SubscriptionObserver>();
            _listeners = new List <BusSubscriptionEventListener>();

            _unregister = () => true;

            _peerUri = bus.ControlBus.Endpoint.Address.Uri;

            var connector = new BusSubscriptionConnector(bus);

            _peerCache = ActorFactory.Create <PeerCache>(x =>
            {
                x.ConstructedBy((fiber, scheduler, inbox) =>
                                new PeerCache(fiber, scheduler, connector, _peerId, _peerUri));
                x.UseSharedScheduler();
                x.HandleOnPoolFiber();
            })
                         .GetActor();
        }
		public SubscriptionRouterService(IServiceBus bus, string network)
		{
			_peerUri = bus.ControlBus.Endpoint.Address.Uri;

			_network = network;

			_peerId = CombGuid.Generate();

			_observers = new List<SubscriptionObserver>();
			_listeners = new List<BusSubscriptionEventListener>();

			_unregister = () => true;

			_peerUri = bus.ControlBus.Endpoint.Address.Uri;

			var connector = new BusSubscriptionConnector(bus);

			_peerCache = ActorFactory.Create<PeerCache>(x =>
				{
					x.ConstructedBy((fiber, scheduler, inbox) =>
					                new PeerCache(fiber, scheduler, connector, _peerId, _peerUri));
					x.UseSharedScheduler();
					x.HandleOnPoolFiber();
				})
				.GetActor();
		}
        public SubscriptionRouterService(IServiceBus bus, SubscriptionRepository repository, string network)
        {
            _peerUri = bus.ControlBus.Endpoint.Address.Uri;

            _repository = repository;
            _network = network;

            _peerId = NewId.NextGuid();

            _observers = new List<SubscriptionObserver>();
            _listeners = new List<BusSubscriptionEventListener>();

            _unregister = () => true;

            _peerUri = bus.ControlBus.Endpoint.Address.Uri;

            var connector = new BusSubscriptionConnector(bus);

            _peerCache = ActorFactory.Create<PeerCache>(x =>
                {
                    x.ConstructedBy((fiber, scheduler, inbox) =>
                                    new PeerCache(connector, _peerId, _peerUri, repository));
                    x.UseSharedScheduler();
                    x.HandleOnPoolFiber();
                })
                .GetActor();

            // at this point, existing subscriptions need to be loaded...

            _repository.Load(this);
        }