public async Task SendToQueueAsJson(string queueName,
                                            string data,
                                            IDictionary <string, string> properties,
                                            bool compressData   = false,
                                            string sessionId    = null,
                                            int?processingDelay = null)
        {
            Guard.IsNullOrWhiteSpace(queueName, nameof(queueName));

            Message message = ConstructMessage(data, compressData, sessionId);

            foreach (KeyValuePair <string, string> property in properties)
            {
                message.UserProperties.Add(property.Key, property.Value);
            }

            if (processingDelay.HasValue)
            {
                message.ScheduledEnqueueTimeUtc = DateTime.UtcNow.AddMinutes(processingDelay.Value);
            }

            AzureServiceBus.IQueueClient queueClient = _managementClient.GetQueueClient(queueName);

            await queueClient.SendAsync(message);
        }
示例#2
0
 public ServiceBusQueueClient(QueueClientConfiguration queueClientConfiguration)
 {
     _QueueClient = CreateQueueClient(queueClientConfiguration);
 }
示例#3
0
 public ServiceBusQueueService(AzureServiceBus.QueueClient queueClient)
 {
     _queueClient = queueClient;
 }