コード例 #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);
        }
コード例 #2
0
        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));
        }
コード例 #3
0
ファイル: ServiceBusHost.cs プロジェクト: sztepen/MassTransit
        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);
        }
コード例 #4
0
        public ServiceBusHost(ServiceBusHostSettings settings, IServiceBusHostTopology hostTopology)
        {
            Settings = settings;
            Topology = hostTopology;

            _messagingFactory        = new Lazy <Task <MessagingFactory> >(CreateMessagingFactory);
            _sessionMessagingFactory = new Lazy <Task <MessagingFactory> >(CreateNetMessagingFactory);
            _namespaceManager        = new Lazy <NamespaceManager>(CreateNamespaceManager);
            _rootNamespaceManager    = new Lazy <NamespaceManager>(CreateRootNamespaceManager);
            _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);
            });
        }
コード例 #5
0
        public ServiceBusHost(IServiceBusHostConfiguration hostConfiguration, IServiceBusHostTopology hostTopology)
            : base(hostConfiguration, hostTopology)
        {
            _hostConfiguration = hostConfiguration;
            Topology           = hostTopology;

            Add(hostConfiguration.ConnectionContextSupervisor);
        }
コード例 #6
0
        public ServiceBusHostConfiguration(IServiceBusBusConfiguration busConfiguration, ServiceBusHostSettings hostSettings,
                                           IServiceBusHostTopology hostTopology)
        {
            _busConfiguration = busConfiguration;
            _hostSettings     = hostSettings;
            _hostTopology     = hostTopology;

            _host = new ServiceBusHost(this);
        }
コード例 #7
0
        public ServiceBusHostConfiguration(IServiceBusBusConfiguration busConfiguration, IServiceBusTopologyConfiguration topologyConfiguration)
            : base(busConfiguration)
        {
            _busConfiguration      = busConfiguration;
            _topologyConfiguration = topologyConfiguration;

            _hostSettings = new HostSettings();
            _hostTopology = new ServiceBusHostTopology(this, _topologyConfiguration);

            _connectionContextSupervisor = new ServiceBusConnectionContextSupervisor(this, topologyConfiguration);
        }
コード例 #8
0
 public ServiceBusHost(IServiceBusHostConfiguration hostConfiguration, IServiceBusHostTopology hostTopology)
     : base(hostConfiguration, hostTopology)
 {
     _hostConfiguration = hostConfiguration;
     Topology           = hostTopology;
 }