public NimbusTopicMessageSender(IQueueManager queueManager, string topicPath) { _queueManager = queueManager; _topicPath = topicPath; _topicClient = new Lazy<TopicClient>(() => _queueManager.CreateTopicSender(_topicPath)); }
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."); }
private TopicClient GetTopicClient() { if (_topicClient != null) { return(_topicClient); } _topicClient = _queueManager.CreateTopicSender(_topicPath).Result; return(_topicClient); }