Beispiel #1
0
        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);
        }
Beispiel #2
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);
        }
Beispiel #3
0
        protected override void Probe(ProbeContext context)
        {
            context.Set(new
            {
                Type = "Azure Service Bus",
                _hostConfiguration.HostAddress,
                _hostConfiguration.Settings.OperationTimeout
            });

            NamespaceContextSupervisor.Probe(context);

            MessagingFactoryContextSupervisor.Probe(context);
        }