コード例 #1
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);
            });
        }
コード例 #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.Selected <ServerBusyException, TimeoutException>().Intervals(100, 500, 1000, 5000, 10000);
        }