示例#1
0
        public static AdditionalMessageData GenerateData(QueueProducerConfiguration configuration)
        {
            if (configuration.GetMessageExpiration().HasValue ||
                configuration.GetMessageDelay().HasValue ||
                configuration.GetMessageRoute().HasValue)
            {
                var data = new AdditionalMessageData();

                // ReSharper disable once PossibleInvalidOperationException
                if (configuration.GetMessageExpiration().HasValue&& configuration.GetMessageExpiration().Value)
                {
                    data.SetExpiration(TimeSpan.FromSeconds(1));
                }

                // ReSharper disable once PossibleInvalidOperationException
                if (configuration.GetMessageDelay().HasValue&& configuration.GetMessageDelay().Value)
                {
                    data.SetDelay(TimeSpan.FromSeconds(5));
                }

                // ReSharper disable once PossibleInvalidOperationException
                if (configuration.GetMessageRoute().HasValue&& configuration.GetMessageRoute().Value)
                {
                    data.Route = DefaultRoute;
                }

                return(data);
            }

            return(new AdditionalMessageData());
        }
        public void Verify(long expectedMessageCount, int expectedStatus, string route)
        {
            VerifyCount(expectedMessageCount, route);
            VerifyStatus(expectedMessageCount, expectedStatus, route);

            // ReSharper disable once PossibleInvalidOperationException
            if (_configuration.GetMessageDelay().HasValue&& _configuration.GetMessageDelay().Value)
            {
                VerifyDelayedProcessing(expectedMessageCount);
            }

            // ReSharper disable once PossibleInvalidOperationException
            if (_configuration.GetMessageExpiration().HasValue&& _configuration.GetMessageExpiration().Value)
            {
                VerifyMessageExpiration(expectedMessageCount);
            }
        }