コード例 #1
0
        public NimbusQueueMessageSender(IQueueManager queueManager, string queuePath)
        {
            _queueManager = queueManager;
            _queuePath = queuePath;

            _queueClient = new Lazy<MessageSender>(() => _queueManager.CreateMessageSender(_queuePath));
        }
コード例 #2
0
        public async Task DeliverAfter(NimbusMessage message, DateTimeOffset deliveryTime)
        {
            if (await _queueManager.QueueExists(message.DeliverTo))
            {
                message.DeliverAfter = deliveryTime;
                var messageSender = await _queueManager.CreateMessageSender(message.DeliverTo);

                var brokeredMessage = await _brokeredMessageFactory.BuildBrokeredMessage(message);

                await messageSender.SendAsync(brokeredMessage);

                return;
            }

            if (await _queueManager.TopicExists(message.DeliverTo))
            {
                message.DeliverAfter = deliveryTime;
                var topicSender = await _queueManager.CreateTopicSender(message.DeliverTo);

                var brokeredMessage2 = await _brokeredMessageFactory.BuildBrokeredMessage(message);

                await topicSender.SendAsync(brokeredMessage2);

                return;
            }

            throw new NotSupportedException("Message redelivery was requested but neither a queue path nor a topic path could be found.");
        }
コード例 #3
0
        public async Task DeliverAfter(NimbusMessage message, DateTimeOffset deliveryTime)
        {
            message.DeliverAfter = deliveryTime;
            var messageSender = await _queueManager.CreateMessageSender(message.DeliverTo);

            var brokeredMessage = await _brokeredMessageFactory.BuildBrokeredMessage(message);

            await messageSender.SendAsync(brokeredMessage);
        }
コード例 #4
0
        private MessageSender GetMessageSender()
        {
            if (_messageSender != null)
            {
                return(_messageSender);
            }

            _messageSender = _queueManager.CreateMessageSender(_queuePath).Result;
            return(_messageSender);
        }