Example #1
0
        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);
        }
Example #2
0
        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);
            });
        }
Example #3
0
        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);
        }
Example #4
0
        protected BaseHost(IHostConfiguration hostConfiguration, IHostTopology hostTopology)
        {
            _hostConfiguration = hostConfiguration;
            _hostTopology      = hostTopology;

            _receiveEndpoints = new ReceiveEndpointCollection();
        }
Example #5
0
        protected BaseHost(IHostConfiguration hostConfiguration)
        {
            _hostConfiguration = hostConfiguration;

            _receiveEndpoints = new ReceiveEndpointCollection();
            Add(_receiveEndpoints);
        }
Example #6
0
        public InMemoryHost(int concurrencyLimit)
        {
            _concurrencyLimit = concurrencyLimit;

            _transports       = new ConcurrentDictionary <string, InMemoryTransport>(StringComparer.OrdinalIgnoreCase);
            _receiveEndpoints = new ReceiveEndpointCollection();
        }
Example #7
0
            public RiderAgent(IClientContextSupervisor supervisor, IReceiveEndpointCollection endpoints, Task ready)
            {
                _supervisor = supervisor;
                _endpoints  = endpoints;

                SetReady(ready);
                SetCompleted(_supervisor.Completed);
            }
Example #8
0
        public InMemoryHost(int concurrencyLimit, Uri baseAddress = null)
        {
            _concurrencyLimit = concurrencyLimit;
            _baseUri          = baseAddress ?? new Uri("loopback://localhost/");

            _transports       = new ConcurrentDictionary <string, InMemoryTransport>(StringComparer.OrdinalIgnoreCase);
            _receiveEndpoints = new ReceiveEndpointCollection();
        }
Example #9
0
 public KafkaRider(IKafkaHostConfiguration hostConfiguration, IBusInstance busInstance, IReceiveEndpointCollection endpoints,
                   ITopicProducerProvider producerProvider, IRiderRegistrationContext registrationContext)
 {
     _hostConfiguration   = hostConfiguration;
     _busInstance         = busInstance;
     _endpoints           = endpoints;
     _producerProvider    = producerProvider;
     _registrationContext = registrationContext;
 }
Example #10
0
        public HttpHost(IHttpHostConfiguration configuration)
        {
            _configuration = configuration;

            _receiveEndpoints = new ReceiveEndpointCollection();
            Add(_receiveEndpoints);

            _httpHostContextSupervisor = new HttpHostContextSupervisor(configuration);
        }
Example #11
0
        public InMemoryHost(int concurrencyLimit, IHostTopology topology, Uri baseAddress = null)
        {
            Topology = topology;
            _baseUri = baseAddress ?? new Uri("loopback://localhost/");

            _messageFabric = new MessageFabric(concurrencyLimit);

            _receiveEndpoints = new ReceiveEndpointCollection();

            var cache = new GreenCache <InMemorySendTransport>(10000, TimeSpan.FromMinutes(1), TimeSpan.FromHours(24), () => DateTime.UtcNow);

            _index = cache.AddIndex("exchangeName", x => x.ExchangeName);
        }
Example #12
0
        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.Selected <ServerBusyException, TimeoutException>().Intervals(100, 500, 1000, 5000, 10000);
        }
Example #13
0
        public ActiveMqHost(IActiveMqHostConfiguration hostConfiguration)
        {
            _hostConfiguration = hostConfiguration;

            _receiveEndpoints = new ReceiveEndpointCollection();
            Add(_receiveEndpoints);

            ConnectionRetryPolicy = Retry.CreatePolicy(x =>
            {
                x.Handle <ActiveMqTransportException>();

                x.Exponential(1000, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(3));
            });

            ConnectionContextSupervisor = new ActiveMqConnectionContextSupervisor(hostConfiguration);
        }
Example #14
0
        public InMemoryHost(IInMemoryHostConfiguration hostConfiguration, int concurrencyLimit, IHostTopology topology, Uri baseAddress = null)
        {
            _hostConfiguration = hostConfiguration;
            Topology           = topology;
            Address            = baseAddress ?? new Uri("loopback://localhost/");

            _messageFabric = new MessageFabric(concurrencyLimit);

            _receiveEndpoints = new ReceiveEndpointCollection();
            Add(_receiveEndpoints);

            var cacheSettings = new CacheSettings(10000, TimeSpan.FromMinutes(1), TimeSpan.FromHours(24));

            var cache = new GreenCache <InMemorySendTransport>(cacheSettings);

            _index = cache.AddIndex("exchangeName", x => x.ExchangeName);
        }