public PeerCache(SubscriptionObserver observer, Guid clientId, Uri controlUri, SubscriptionRepository repository) { _peers = new DictionaryCache<Uri, ActorRef>(); _peerUri = controlUri; _peerIds = new DictionaryCache<Guid, Uri>(); _peerHandlerFactory = ActorFactory.Create((f, s, i) => new PeerHandler(i, observer, repository)); // create a peer for our local client WithPeer(clientId, controlUri, x => { }, true); }
public PeerCache(Fiber fiber, Scheduler scheduler, SubscriptionObserver observer, Guid clientId, Uri controlUri) { _peers = new DictionaryCache<Uri, ActorRef>(); _peerUri = controlUri; _fiber = fiber; _scheduler = scheduler; _peerIds = new DictionaryCache<Guid, Uri>(); _peerHandlerFactory = ActorFactory.Create((f, s, i) => new PeerHandler(f, s, i, observer)); // create a peer for our local client WithPeer(clientId, controlUri, x => { }, true); }
/// <summary> /// Creates a new endpoint factory instance /// </summary> /// <param name="transportFactories">Dictionary + contents owned by the EndpointFactory instance.</param> /// <param name="endpointBuilders"></param> /// <param name="defaults"></param> public EndpointFactory([NotNull] IDictionary<string, ITransportFactory> transportFactories, [NotNull] IDictionary<Uri, EndpointBuilder> endpointBuilders, [NotNull] IEndpointFactoryDefaultSettings defaults) { if (transportFactories == null) throw new ArgumentNullException("transportFactories"); if (endpointBuilders == null) throw new ArgumentNullException("endpointBuilders"); if (defaults == null) throw new ArgumentNullException("defaults"); _transportFactories = new ConcurrentCache<string, ITransportFactory>(transportFactories); _defaults = defaults; _endpointBuilders = new ConcurrentCache<Uri, EndpointBuilder>(endpointBuilders); }
public AzureServiceBusTransportFactory(IEnumerable<ConnectionSettingsBuilder> builders, IInboundSettings inboundSettings, IOutboundSettings outboundSettings) { _addresses = new ConcurrentCache<Uri, IAzureServiceBusEndpointAddress>(); _connections = new ConcurrentCache<string, ConnectionHandler<AzureServiceBusConnection>>(); _connectionSettings = new ConcurrentCache<string, IConnectionSettings>(StringComparer.InvariantCultureIgnoreCase); _connectionSettingsBuilders = new ConcurrentCache<string, ConnectionSettingsBuilder>(x => x.Namespace, builders); _formatter = new AzureServiceBusMessageNameFormatter(); _inboundSettings = inboundSettings; _outboundSettings = outboundSettings; _log.Debug("created new transport factory"); }
ConnectionHandler<AzureServiceBusConnection> GetConnection( Cache<string, ConnectionHandler<AzureServiceBusConnection>> cache, IAzureServiceBusEndpointAddress address) { var ns = address.Uri.Host; return cache.Get(ns, _ => { if (_log.IsDebugEnabled) _log.DebugFormat("Creating RabbitMQ connection: {0}", address.Uri); ConnectionSettingsBuilder builder = _connectionSettingsBuilders.Get(ns, __ => { if (_log.IsDebugEnabled) _log.DebugFormat("Using default configurator for connection: {0}", address.Uri); var configurator = new NamespaceConnectionSettingsConfigurator(ns); return configurator.Configure(); }); IConnectionSettings connectionSettings = builder.Build(); var connection = new AzureServiceBusConnectionImpl(address, connectionSettings.TokenProvider); return new ConnectionHandlerImpl<AzureServiceBusConnection>(connection); }); }
public ServiceCatalog() { _services = new ConcurrentCache<int, IList<IBusService>>(x => new List<IBusService>()); }