public ServiceBusHost(ServiceBusHostSettings settings) { Settings = settings; _messagingFactory = new Lazy <Task <MessagingFactory> >(CreateMessagingFactory); _sessionMessagingFactory = new Lazy <Task <MessagingFactory> >(CreateNetMessagingFactory); _namespaceManager = new Lazy <NamespaceManager>(CreateNamespaceManager); _rootNamespaceManager = new Lazy <NamespaceManager>(CreateRootNamespaceManager); MessageNameFormatter = new ServiceBusMessageNameFormatter(); _receiveEndpoints = new ReceiveEndpointCollection(); _supervisor = new TaskSupervisor($"{TypeMetadataCache<ServiceBusHost>.ShortName} - {Settings.ServiceUri}"); RetryPolicy = Retry.CreatePolicy(x => { x.Ignore <MessagingEntityNotFoundException>(); x.Ignore <MessagingEntityAlreadyExistsException>(); x.Ignore <MessageNotFoundException>(); x.Ignore <MessageSizeExceededException>(); x.Ignore <NoMatchingSubscriptionException>(); x.Ignore <TransactionSizeExceededException>(); x.Handle <ServerBusyException>(exception => exception.IsTransient || exception.IsWrappedExceptionTransient()); x.Handle <MessagingException>(exception => exception.IsTransient || exception.IsWrappedExceptionTransient()); x.Handle <TimeoutException>(); x.Intervals(100, 500, 1000, 5000, 10000); }); }
public ServiceBusHost(IServiceBusHostConfiguration hostConfiguration, IServiceBusHostTopology hostTopology) : base(hostConfiguration, hostTopology) { _hostConfiguration = hostConfiguration; _hostTopology = hostTopology; RetryPolicy = Retry.CreatePolicy(x => { x.Ignore <MessagingEntityNotFoundException>(); x.Ignore <MessagingEntityAlreadyExistsException>(); x.Ignore <MessageNotFoundException>(); x.Ignore <MessageSizeExceededException>(); x.Handle <ServerBusyException>(exception => exception.IsTransient); x.Handle <TimeoutException>(); x.Interval(5, TimeSpan.FromSeconds(10)); }); MessagingFactoryContextSupervisor = new MessagingFactoryContextSupervisor(hostConfiguration); NamespaceContextSupervisor = new NamespaceContextSupervisor(hostConfiguration); var cacheSettings = new CacheSettings(SendEndpointCacheDefaults.Capacity, SendEndpointCacheDefaults.MinAge, SendEndpointCacheDefaults.MaxAge); var cache = new GreenCache <CachedSendTransport>(cacheSettings); _index = cache.AddIndex("key", x => x.Address); }
public ServiceBusHost(ServiceBusHostSettings settings, IServiceBusHostTopology hostTopology, IServiceBusBusConfiguration busConfiguration) { Settings = settings; Topology = hostTopology; var busConfiguration1 = busConfiguration; _receiveEndpoints = new ReceiveEndpointCollection(); RetryPolicy = Retry.CreatePolicy(x => { x.Ignore <MessagingEntityNotFoundException>(); x.Ignore <MessagingEntityAlreadyExistsException>(); x.Ignore <MessageNotFoundException>(); x.Ignore <MessageSizeExceededException>(); x.Handle <ServerBusyException>(exception => exception.IsTransient); x.Handle <TimeoutException>(); x.Interval(5, TimeSpan.FromSeconds(10)); }); BasePath = settings.ServiceUri.AbsolutePath.Trim('/'); var serviceBusRetryPolicy = CreateRetryPolicy(settings); MessagingFactoryCache = new MessagingFactoryCache(settings.ServiceUri, CreateMessagingFactorySettings(settings), serviceBusRetryPolicy); NamespaceCache = new NamespaceCache(settings.ServiceUri, CreateNamespaceManagerSettings(settings, serviceBusRetryPolicy)); _receiveEndpointFactory = new ServiceBusReceiveEndpointFactory(busConfiguration1, this); _subscriptionEndpointFactory = new ServiceBusSubscriptionEndpointFactory(busConfiguration1, this); }
public ServiceBusHost(IServiceBusHostConfiguration hostConfiguration) { _hostConfiguration = hostConfiguration; _receiveEndpoints = new ReceiveEndpointCollection(); Add(_receiveEndpoints); RetryPolicy = Retry.CreatePolicy(x => { x.Ignore <MessagingEntityNotFoundException>(); x.Ignore <MessagingEntityAlreadyExistsException>(); x.Ignore <MessageNotFoundException>(); x.Ignore <MessageSizeExceededException>(); x.Handle <ServerBusyException>(exception => exception.IsTransient); x.Handle <TimeoutException>(); x.Interval(5, TimeSpan.FromSeconds(10)); }); BasePath = _hostConfiguration.HostAddress.AbsolutePath.Trim('/'); MessagingFactoryContextSupervisor = new MessagingFactoryContextSupervisor(hostConfiguration); NamespaceContextSupervisor = new NamespaceContextSupervisor(hostConfiguration); }
public ServiceBusHostConfiguration(IServiceBusBusConfiguration busConfiguration, IServiceBusTopologyConfiguration topologyConfiguration) : base(busConfiguration) { _busConfiguration = busConfiguration; _topologyConfiguration = topologyConfiguration; _hostSettings = new HostSettings(); _hostTopology = new ServiceBusHostTopology(this, _topologyConfiguration); ReceiveTransportRetryPolicy = Retry.CreatePolicy(x => { x.Ignore <MessagingEntityNotFoundException>(); x.Ignore <MessagingEntityAlreadyExistsException>(); x.Ignore <MessageNotFoundException>(); x.Ignore <MessageSizeExceededException>(); x.Ignore <UnauthorizedException>(); x.Handle <ServerBusyException>(exception => exception.IsTransient); x.Handle <TimeoutException>(); x.Interval(5, TimeSpan.FromSeconds(10)); }); _connectionContext = new Recycle <IConnectionContextSupervisor>(() => new ConnectionContextSupervisor(this, topologyConfiguration)); }
public RabbitMqHostConfiguration(IRabbitMqBusConfiguration busConfiguration, IRabbitMqTopologyConfiguration topologyConfiguration) : base(busConfiguration) { _busConfiguration = busConfiguration; _hostSettings = new ConfigurationHostSettings { Host = "localhost", VirtualHost = "/", Port = 5672, Username = "******", Password = "******" }; var messageNameFormatter = new RabbitMqMessageNameFormatter(); _hostTopology = new RabbitMqHostTopology(this, messageNameFormatter, _hostSettings.HostAddress, topologyConfiguration); ReceiveTransportRetryPolicy = Retry.CreatePolicy(x => { x.Handle <ConnectionException>(); x.Handle <MessageNotConfirmedException>(exception => exception.Message.Contains("CONNECTION_FORCED")); x.Ignore <AuthenticationFailureException>(); x.Exponential(1000, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(3)); }); _connectionContext = new Recycle <IConnectionContextSupervisor>(() => new ConnectionContextSupervisor(this, topologyConfiguration)); }
public ConnectionContextFactory(IAmazonSqsHostConfiguration hostConfiguration) { _hostConfiguration = hostConfiguration; _connectionRetryPolicy = Retry.CreatePolicy(x => { x.Handle <AmazonSqsConnectException>(); x.Exponential(1000, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(3)); }); }
public ConnectionContextFactory(IActiveMqHostConfiguration configuration) { _configuration = configuration; _connectionRetryPolicy = Retry.CreatePolicy(x => { x.Handle <ActiveMqTransportException>(); x.Exponential(1000, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(3)); }); }
public QueueSendClient(QueueClient queueClient) { _queueClient = queueClient; _retryPolicy = Retry.CreatePolicy(x => { x.Handle <ServerBusyException>(); x.Handle <MessagingException>(exception => exception.IsTransient || exception.IsWrappedExceptionTransient()); x.Handle <MessagingCommunicationException>(exception => exception.IsTransient || exception.IsWrappedExceptionTransient()); x.Handle <TimeoutException>(); x.Interval(5, TimeSpan.FromSeconds(10)); }); }
public ActiveMqHost(IActiveMqHostConfiguration hostConfiguration) : base(hostConfiguration) { _hostConfiguration = hostConfiguration; ConnectionRetryPolicy = Retry.CreatePolicy(x => { x.Handle <ActiveMqTransportException>(); x.Exponential(1000, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(3)); }); ConnectionContextSupervisor = new ActiveMqConnectionContextSupervisor(hostConfiguration); }
public AmazonSqsHost(IAmazonSqsHostConfiguration hostConfiguration, IAmazonSqsHostTopology hostTopology) : base(hostConfiguration, hostTopology) { _hostConfiguration = hostConfiguration; _hostTopology = hostTopology; ConnectionRetryPolicy = Retry.CreatePolicy(x => { x.Handle <AmazonSqsTransportException>(); x.Exponential(1000, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(3)); }); ConnectionContextSupervisor = new AmazonSqsConnectionContextSupervisor(hostConfiguration, hostTopology); }
public RabbitMqHost(IRabbitMqHostConfiguration hostConfiguration, IRabbitMqHostTopology hostTopology) : base(hostConfiguration, hostTopology) { _hostConfiguration = hostConfiguration; _hostTopology = hostTopology; ConnectionRetryPolicy = Retry.CreatePolicy(x => { x.Handle <RabbitMqConnectionException>(); x.Exponential(1000, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(3)); }); ConnectionContextSupervisor = new RabbitMqConnectionContextSupervisor(hostConfiguration, hostTopology); }
public AmazonSqsHost(IAmazonSqsHostConfiguration hostConfiguration) { _hostConfiguration = hostConfiguration; _receiveEndpoints = new ReceiveEndpointCollection(); Add(_receiveEndpoints); ConnectionRetryPolicy = Retry.CreatePolicy(x => { x.Handle <AmazonSqsTransportException>(); x.Exponential(1000, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(3)); }); ConnectionContextSupervisor = new AmazonSqsConnectionContextSupervisor(hostConfiguration); }
public ConnectionContextFactory(IRabbitMqHostConfiguration configuration, IRabbitMqHostTopology hostTopology) { _configuration = configuration; _hostTopology = hostTopology; _description = configuration.Settings.ToDescription(); _connectionRetryPolicy = Retry.CreatePolicy(x => { x.Handle <RabbitMqConnectionException>(); x.Exponential(1000, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(3)); }); _connectionFactory = new Lazy <ConnectionFactory>(_configuration.Settings.GetConnectionFactory); }
public ActiveMqHostConfiguration(IActiveMqBusConfiguration busConfiguration, IActiveMqTopologyConfiguration topologyConfiguration) : base(busConfiguration) { _busConfiguration = busConfiguration; _hostSettings = new ConfigurationHostSettings(new Uri("activemq://localhost")); _hostTopology = new ActiveMqHostTopology(this, topologyConfiguration); ReceiveTransportRetryPolicy = Retry.CreatePolicy(x => { x.Handle <ConnectionException>(); x.Exponential(1000, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(3)); }); _connectionContext = new Recycle <IConnectionContextSupervisor>(() => new ConnectionContextSupervisor(this, topologyConfiguration)); }
public ActiveMqHost(IActiveMqBusConfiguration busConfiguration, ActiveMqHostSettings settings, IActiveMqHostTopology topology) { _settings = settings; _topology = topology; ReceiveEndpoints = new ReceiveEndpointCollection(); ConnectionRetryPolicy = Retry.CreatePolicy(x => { x.Handle <ActiveMqTransportException>(); x.Exponential(1000, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(3)); }); ConnectionCache = new ActiveMqConnectionCache(settings, _topology); ReceiveEndpointFactory = new ActiveMqReceiveEndpointFactory(busConfiguration, this); }
public GrpcHostConfiguration(IGrpcBusConfiguration busConfiguration, Uri baseAddress, IGrpcTopologyConfiguration topologyConfiguration) : base(busConfiguration) { _busConfiguration = busConfiguration; BaseAddress = baseAddress; _hostTopology = new GrpcHostTopology(this, topologyConfiguration); _serverConfigurations = new List <GrpcServerConfiguration>(); ReceiveTransportRetryPolicy = Retry.CreatePolicy(x => { x.Handle <ConnectionException>(); x.Exponential(1000, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(3)); }); _transportProvider = new Recycle <IGrpcTransportProvider>(() => new GrpcTransportProvider(this, topologyConfiguration)); }
public InMemoryHostConfiguration(IInMemoryBusConfiguration busConfiguration, Uri baseAddress, IInMemoryTopologyConfiguration topologyConfiguration) : base(busConfiguration) { _busConfiguration = busConfiguration; _hostAddress = baseAddress ?? new Uri("loopback://localhost/"); _hostTopology = new InMemoryHostTopology(this, topologyConfiguration); TransportConcurrencyLimit = Math.Min(Environment.ProcessorCount, 4); ReceiveTransportRetryPolicy = Retry.CreatePolicy(x => { x.Handle <ConnectionException>(); x.Exponential(1000, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(3)); }); _transportProvider = new Recycle <IInMemoryTransportProvider>(() => new InMemoryTransportProvider(this, topologyConfiguration)); }
public RabbitMqHost(IRabbitMqHostConfiguration hostConfiguration, IRabbitMqHostTopology hostTopology) : base(hostConfiguration, hostTopology) { _hostConfiguration = hostConfiguration; _hostTopology = hostTopology; ConnectionRetryPolicy = Retry.CreatePolicy(x => { x.Handle <RabbitMqConnectionException>(); x.Exponential(1000, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(3)); }); ConnectionContextSupervisor = new RabbitMqConnectionContextSupervisor(hostConfiguration, hostTopology); var cacheSettings = new CacheSettings(SendEndpointCacheDefaults.Capacity, SendEndpointCacheDefaults.MinAge, SendEndpointCacheDefaults.MaxAge); var cache = new GreenCache <CachedSendTransport>(cacheSettings); _index = cache.AddIndex("key", x => x.Address); }
public AmazonSqsHostConfiguration(IAmazonSqsBusConfiguration busConfiguration, IAmazonSqsTopologyConfiguration topologyConfiguration) : base(busConfiguration) { _busConfiguration = busConfiguration; _topologyConfiguration = topologyConfiguration; _hostSettings = new ConfigurationHostSettings(); var messageNameFormatter = new AmazonSqsMessageNameFormatter(); _hostTopology = new AmazonSqsHostTopology(this, messageNameFormatter, topologyConfiguration); ReceiveTransportRetryPolicy = Retry.CreatePolicy(x => { x.Handle <AmazonSqsTransportException>(); x.Exponential(1000, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(3)); }); _connectionContext = new Recycle <IConnectionContextSupervisor>(() => new ConnectionContextSupervisor(this, topologyConfiguration)); }