Ejemplo n.º 1
0
        /// <summary>
        /// 添加消息
        /// </summary>
        /// <param name="msg">消息</param>
        /// <returns></returns>
        public async Task AddMessage(string msg)
        {
            // Create the queue
            _queueClient.CreateIfNotExists();

            if (_queueClient.Exists())
            {
                // Send a message to the queue
                await _queueClient.SendMessageAsync(msg.EncryptBase64());
            }
        }
    public async Task <Product.API.Model.QueueMessage> GetMessage()
    {
        if (queueClient.Exists())
        {
            PeekedMessage[] peekedMessage = queueClient.PeekMessages();
            string          Jsonmessage   = peekedMessage[0].MessageText;

            return(JsonConvert.DeserializeObject <Product.API.Model.QueueMessage>(Jsonmessage));
        }
        return(null);
    }
 public async Task Enqueue(ConfirmationEmailDTO obj, CancellationToken ct)
 {
     if (_queueClient.Exists())
     {
         await _queueClient.SendMessageAsync(obj.ToBase64String(), ct);
     }
 }
Ejemplo n.º 4
0
        public bool CreateQueue(string queueName)
        {
            try
            {
                QueueClient queueClient = CreateQueueClient(queueName);

                queueClient.CreateIfNotExists();

                if (queueClient.Exists())
                {
                    Console.WriteLine($"Queue created: '{queueClient.Name}'");
                    return(true);
                }
                else
                {
                    Console.WriteLine($"Client not created!");
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Exception: {ex.Message}");
                return(false);
            }
        }
Ejemplo n.º 5
0
        public async Task <MessageFacade> ReadMessageAsync(string queueName, int?dequeueTimeoutSeconds = 30)
        {
            MessageFacade toReturn = null;

            try
            {
                QueueClient queueClient = new QueueClient(this.ConnectionString, queueName);
                if (queueClient.Exists())
                {
                    QueueMessage[] retrievedMessage = await queueClient.ReceiveMessagesAsync(1, TimeSpan.FromSeconds((double)dequeueTimeoutSeconds));

                    if (retrievedMessage != null && retrievedMessage.ToList().Count == 1)
                    {
                        toReturn = new MessageFacade()
                        {
                            MessageId   = retrievedMessage[0].MessageId,
                            MessageText = retrievedMessage[0].MessageText,
                            PopReceipt  = retrievedMessage[0].PopReceipt
                        };
                    }
                }
            }
            catch (Exception ex)
            {
                this.ErrorMessage = ex.ToString();
            }
            return(toReturn);
        }
Ejemplo n.º 6
0
        public async Task <MessageFacade> PeekMessageAsync(string queueName)
        {
            MessageFacade toReturn = null;

            try
            {
                QueueClient queueClient = new QueueClient(this.ConnectionString, queueName);
                if (queueClient.Exists())
                {
                    PeekedMessage[] peekedMessage = await queueClient.PeekMessagesAsync(1);

                    if (peekedMessage != null && peekedMessage.ToList().Count == 1)
                    {
                        toReturn = new MessageFacade()
                        {
                            MessageId   = peekedMessage[0].MessageId,
                            MessageText = peekedMessage[0].MessageText
                        };
                    }
                }
            }
            catch (Exception ex)
            {
                this.ErrorMessage = ex.ToString();
            }
            return(toReturn);
        }
        public IActionResult DequeueMessage(string key)
        {
            string storedKey = Environment.GetEnvironmentVariable(Environment.GetEnvironmentVariable("STORED_KEY"));

            if (key == storedKey)
            {
                // Get the connection string from app settings
                string connectionString = Environment.GetEnvironmentVariable("AZURE_QUEUE_CONNECTION_STRING");

                // Instantiate a QueueClient which will be used to create and manipulate the queue
                QueueClient queueClient = new QueueClient(connectionString, "rgbscreenqueue");

                // Create the queue if it doesn't already exist
                queueClient.CreateIfNotExists();

                if (queueClient.Exists())
                {
                    // Send a message to the queue
                    Response <QueueMessage> response = queueClient.ReceiveMessage();


                    return(Json(JsonConvert.SerializeObject(response.GetRawResponse())));
                }
            }

            return(Json(new object()));
        }
        public IActionResult RgbScreenPost()
        {
            string jsonString = string.Empty;

            using (StreamReader reader = new StreamReader(Request.Body, Encoding.UTF8))
            {
                jsonString = reader.ReadToEndAsync().Result;
            }

            // Get the connection string from app settings
            string connectionString = Environment.GetEnvironmentVariable("AZURE_QUEUE_CONNECTION_STRING");

            // Instantiate a QueueClient which will be used to create and manipulate the queue
            QueueClient queueClient = new QueueClient(connectionString, "rgbscreenqueue");

            // Create the queue if it doesn't already exist
            queueClient.CreateIfNotExists();

            if (queueClient.Exists())
            {
                // Send a message to the queue
                queueClient.SendMessage(jsonString);
            }

            Console.WriteLine($"Inserted: {jsonString}");

            return(new OkResult());
        }
Ejemplo n.º 9
0
        public static async void ProcessCallbackItem(Model.CallbackItem cbItem)
        {
            var config = GetConfig();
            var client = await GetHttpClient(config);

            var response = await client.GetStringAsync(cbItem.contentUri);

            Model.AuditItem[] auditItems = JsonSerializer.Deserialize <Model.AuditItem[]>(response);
            var sitesToCapture           = getSitesToCapture();
            var siteDictionary           = new Dictionary <string, string>();

            foreach (var siteToCapture in sitesToCapture)
            {
                siteDictionary.Add(siteToCapture.SiteId, siteToCapture.EventsToCapture);
            }
            QueueClient queueClient = new QueueClient(config["StorageAccountConnectionString"], config["AuditQueueName"]);

            // Create the queue if it doesn't already exist
            queueClient.CreateIfNotExists();

            foreach (Model.AuditItem auditItem in auditItems)
            {
                if (auditItem.Site != null && siteDictionary.ContainsKey(auditItem.Site) && (siteDictionary[auditItem.Site].Contains(auditItem.Operation) || siteDictionary[auditItem.Site] == "*"))
                {
                    if (queueClient.Exists())
                    {
                        queueClient.SendMessage(Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes((string)JsonSerializer.Serialize(auditItem))));
                    }
                }
            }
        }
Ejemplo n.º 10
0
        public bool CreateQueue()
        {
            try
            {
                // Get the connection string from app settings
                string connectionString = _appConfiguration.Value.StorageConnectionString;

                // Instantiate a QueueClient which will be used to create and manipulate the queue
                _queueClient = new QueueClient(connectionString, _queueName);

                // Create the queue
                _queueClient.CreateIfNotExists();

                if (_queueClient.Exists())
                {
                    Console.WriteLine($"Queue created: '{_queueClient.Name}'");
                    return(true);
                }
                else
                {
                    Console.WriteLine($"Make sure the Azure storage emulator is running and try again.");
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Exception: {ex.Message}\n\n");
                Console.WriteLine($"Make sure the Azure storage emulator is running and try again.");
                return(false);
            }
        }
Ejemplo n.º 11
0
        public bool CreateQueue(string queueName)
        {
            try
            {
                QueueClient queueClient = new QueueClient(_connectionString, queueName);

                queueClient.CreateIfNotExists();

                if (queueClient.Exists())
                {
                    Console.WriteLine($"Queue created: '{queueClient.Name}'");
                    return(true);
                }
                else
                {
                    Console.WriteLine($"Make sure the Azurite storage emulator running and try again.");
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Exception: {ex.Message}\n\n");
                Console.WriteLine($"Make sure the Azurite storage emulator running and try again.");
                return(false);
            }
        }
Ejemplo n.º 12
0
        public void DequeueMessages()
        {
            // <snippet_DequeueMessages>
            // Get the connection string from app settings
            string connectionString = ConfigurationManager.AppSettings["StorageConnectionString"];

            // Instantiate a QueueClient which will be used to create and manipulate the queue
            QueueClient queueClient = new QueueClient(connectionString, "myqueue");

            if (queueClient.Exists())
            {
                // Receive and process 20 messages
                QueueMessage[] receivedMessages = queueClient.ReceiveMessages(20, TimeSpan.FromMinutes(5));

                foreach (QueueMessage message in receivedMessages)
                {
                    // Process (i.e. print) the messages in less than 5 minutes
                    Console.WriteLine($"De-queued message: '{message.MessageText}'");

                    // Delete the message
                    queueClient.DeleteMessage(message.MessageId, message.PopReceipt);
                }
            }
            // </snippet_DequeueMessages>
        }
Ejemplo n.º 13
0
        //-------------------------------------------------
        // Create a message queue
        //-------------------------------------------------
        public bool CreateQueue()
        {
            try
            {
                // <snippet_CreateQueue>
                // Get the connection string from app settings
                string connectionString = ConfigurationManager.AppSettings["storageConnectionString"];

                // Instantiate a QueueClient which will be used to create and manipulate the queue
                QueueClient queueClient = new QueueClient(connectionString, "myqueue");

                // Create the queue
                queueClient.CreateIfNotExists();
                // </snippet_CreateQueue>

                if (queueClient.Exists())
                {
                    Console.WriteLine($"Queue created: '{queueClient.Name}'");
                    return(true);
                }
                else
                {
                    Console.WriteLine($"Make sure the Azurite storage emulator running and try again.");
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Exception: {ex.Message}\n\n");
                Console.WriteLine($"Make sure the Azurite storage emulator running and try again.");
                return(false);
            }
        }
        public static async Task Run([TimerTrigger("0 */30 * * * *")] TimerInfo myTimer, ILogger log)
        {
            log.LogInformation($"C# Timer trigger function executed at: {DateTime.Now}");

            TableStorageOperations cloudTableClient = await TableStorageOperations.GetClientAsync();

            TableQuery <TenantModel> query   = new TableQuery <TenantModel>().Where(TableQuery.GenerateFilterConditionForBool(nameof(TenantModel.IsIotHubDeployed), QueryComparisons.Equal, true));
            List <TenantModel>       tenants = await cloudTableClient.QueryAsync <TenantModel>("tenant", query);

            if (tenants != null && tenants.Count > 0)
            {
                // Get the connection string from app settings
                string connectionString = Environment.GetEnvironmentVariable("AzureStorageConnectionString", EnvironmentVariableTarget.Process);

                // Instantiate a QueueClient which will be used to create and manipulate the queue
                QueueClient queueClient = new QueueClient(connectionString, "tenantstosync");

                await queueClient.CreateIfNotExistsAsync();

                if (queueClient.Exists())
                {
                    foreach (var tenant in tenants)
                    {
                        var tenantMessage = JsonConvert.SerializeObject(new TenantQueueItem(tenant.TenantId));

                        // Send a message to the queue
                        var encodedString = Base64Encode(tenantMessage);
                        queueClient.SendMessage(encodedString);
                    }
                }
            }
        }
Ejemplo n.º 15
0
 private static async Task <Unit> CrawlProducts(QueueClient queueClient, SearchTerm searchTerm)
 {
     if (queueClient.Exists())
     {
         await queueClient.SendMessageAsync(searchTerm);
     }
     return(Unit.Instance);
 }
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.UTF8;
            UrlCrawler bot = new UrlCrawler();
            //bot.Run();

            var queueName = "runurlqueue";
            // Get the connection string from app settings
            string connectionString = ConfigurationManager.AppSettings["StorageConnectionString"];

            // Instantiate a QueueClient which will be used to manipulate the queue
            QueueClient queueClient = new QueueClient(connectionString, queueName);

            //queue polling
            //if have messgae in queue then -> process messgae
            //if not -> waiting for specific time then stop
            var currentInterval = 0;
            var maxInterval     = 15;

            if (queueClient.Exists())
            {
                while (true)
                {
                    try
                    {
                        // Get the next message
                        QueueMessage[] retrievedMessage = queueClient.ReceiveMessages(1, TimeSpan.FromSeconds(120));
                        //get messge text
                        var message = retrievedMessage[0].MessageText;
                        // Process the message in less than 120 seconds
                        Console.WriteLine(message);
                        //run bot when received message
                        bot.Run();
                        //reset interval
                        currentInterval = 0;
                        Console.WriteLine(currentInterval);
                        // Delete the message
                        queueClient.DeleteMessage(retrievedMessage[0].MessageId, retrievedMessage[0].PopReceipt);
                    }
                    catch (Exception err)
                    {
                        Console.WriteLine(err.Message);
                        if (currentInterval < maxInterval)
                        {
                            currentInterval++;
                        }
                        else
                        {
                            break;
                        }
                        Console.WriteLine("waiting for " + currentInterval + "s");
                        Thread.Sleep(TimeSpan.FromSeconds(currentInterval));
                    }
                }
            }
            Console.WriteLine("Press any key to continue...");
            Console.ReadLine();
        }
Ejemplo n.º 17
0
        /// <summary>
        /// This is where the work of the completer happens
        /// </summary>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        private async Task RunAsync(CancellationToken cancellationToken)
        {
            var messageCount = 0;
            var backoff      = 1;

            while (_queueClient.Exists())
            {
                // Receive and process messages in batches
                var receivedMessages = (await _queueClient.ReceiveMessagesAsync(20, TimeSpan.FromMinutes(5))).Value;

                // there was something to read out of the queue
                if (receivedMessages.Any())
                {
                    // reset the backoff
                    backoff = 1;

                    // iterate over the messages we got from the queue
                    foreach (var receivedMessage in receivedMessages)
                    {
                        // Deseralize the message
                        var message = JsonConvert.DeserializeObject <Replicatable>(receivedMessage.MessageText);

                        // Convert the detination uri string to a uri
                        var newUri = new Uri(message.Destination);

                        // lookup the image record in the database
                        var image = _imageContext.Images
                                    .FirstOrDefault(x => x.ImageId == int.Parse(message.DiagnosticInfo["ImageId"]));

                        if (image != null)
                        {
                            // update the image record with the new url (without the SAS)
                            image.Url = newUri.GetLeftPart(UriPartial.Path);

                            // Save th changes to sql server
                            await _imageContext.SaveChangesAsync(cancellationToken);

                            // incrament our counter
                            messageCount++;
                        }

                        // Delete the message
                        _queueClient.DeleteMessage(receivedMessage.MessageId, receivedMessage.PopReceipt);
                    }

                    _logger.LogInformation($"Sample WebAppCompleter Worker batch complete. Total message count {messageCount} at {DateTimeOffset.UtcNow}");
                }
                else
                {
                    //queue empty, exponential backoff (in minutes)
                    await Task.Delay(backoff * 60000, cancellationToken);

                    backoff = backoff * 2;
                }
            }

            _logger.LogInformation($"Sample WebAppCompleter Worker Done updating the DB. Total message count {messageCount} at {DateTimeOffset.UtcNow}");
        }
Ejemplo n.º 18
0
        private void InsertMessage(string queueName, string message, string connectionString)
        {
            QueueClient queueClient = new QueueClient(connectionString, queueName);

            queueClient.CreateIfNotExists();

            if (queueClient.Exists())
            {
                queueClient.SendMessage(message);
            }
        }
Ejemplo n.º 19
0
        public QueueReader(string connectionString, string queueName)
        {
            ParmCheck.NotNullOrEmpty(nameof(connectionString), connectionString);
            ParmCheck.NotNullOrEmpty(nameof(queueName), queueName);

            _queueClient = new QueueClient(connectionString, queueName);
            if (_queueClient.Exists() == false)
            {
                throw new InvalidOperationException($"Queue not found: {queueName}");
            }
        }
Ejemplo n.º 20
0
        public void SendMessage(string message)
        {
            // Instantiate a QueueClient which will be used to create and manipulate the queue
            QueueClient queueClient = new QueueClient(_connectionStrings.AzureWebJobsStorage, _option.QueueName);

            if (queueClient.Exists())
            {
                // Send a message to the queue
                queueClient.SendMessage(message);
            }
        }
Ejemplo n.º 21
0
        public void DeleteQueue(string queueName)
        {
            QueueClient queueClient = CreateQueueClient(queueName);

            if (queueClient.Exists())
            {
                queueClient.Delete();
            }

            Console.WriteLine($"Queue deleted: '{queueClient.Name}'");
        }
Ejemplo n.º 22
0
        public static async Task Run([QueueTrigger("tenantstosync", Connection = "AzureStorageConnectionString")] string myQueueItem, ILogger log)
        {
            log.LogInformation($"C# Queue trigger function processed: {myQueueItem}");

            if (!string.IsNullOrEmpty(myQueueItem))
            {
                TenantQueueItem tenant = JsonConvert.DeserializeObject <TenantQueueItem>(myQueueItem);

                if (tenant != null && !string.IsNullOrWhiteSpace(tenant.TenantId))
                {
                    List <DeploymentServiceModel> deploymentsToSync  = new List <DeploymentServiceModel>();
                    IEnumerable <Configuration>   deploymentsFromHub = null;
                    try
                    {
                        deploymentsFromHub = await TenantConnectionHelper.GetRegistry(tenant.TenantId).GetConfigurationsAsync(100);

                        DeploymentSyncService service = new DeploymentSyncService();

                        deploymentsToSync.AddRange(await service.GetDeploymentsToSync(tenant.TenantId, deploymentsFromHub));
                    }
                    catch (Exception)
                    {
                        log.LogError($"Error occurrred while fetching deployments");
                        throw;
                    }

                    if (deploymentsToSync != null && deploymentsToSync.Count > 0)
                    {
                        // Get the connection string from app settings
                        string connectionString = Environment.GetEnvironmentVariable("AzureStorageConnectionString", EnvironmentVariableTarget.Process);

                        // Instantiate a QueueClient which will be used to create and manipulate the queue
                        QueueClient queueClient = new QueueClient(connectionString, "deploymentstosync");

                        await queueClient.CreateIfNotExistsAsync();

                        if (queueClient.Exists())
                        {
                            foreach (var deploymentToSync in deploymentsToSync)
                            {
                                DeploymentModel deployment = new DeploymentModel();
                                deployment.TenantId      = tenant.TenantId;
                                deployment.Deployment    = deploymentToSync;
                                deployment.Configuration = deploymentsFromHub.FirstOrDefault(d => d.Id == deploymentToSync.Id);

                                var deploymentToSyncString = JsonConvert.SerializeObject(deployment);

                                queueClient.SendMessage(Base64Encode(deploymentToSyncString));
                            }
                        }
                    }
                }
            }
        }
        async Task RunWithOptions(Options options)
        {
            Console.WriteLine("I see dead people");
            if (options.TestPlan != null && options.TestRun != null)
            {
                DeleteReportsFromDatabase(testPlan: options.TestPlan, testRun: options.TestRun);
                _appLifetime.StopApplication();
                return;
            }

            try
            {
                bool runOnceAndStop       = false;
                bool alreadyGotTheResults = false;

                while (!commonCancellationToken.IsCancellationRequested && !runOnceAndStop)
                {
                    runOnceAndStop = Environment.GetEnvironmentVariable("RunOnceAndStop") != null?bool.Parse(Environment.GetEnvironmentVariable("RunOnceAndStop")) : false;

                    var sqlConnectionString     = Environment.GetEnvironmentVariable("JtlReportingDatabase");
                    var storageConnectionString = Environment.GetEnvironmentVariable("JtlReportingStorage");
                    logger.LogInformation("Checking for the existence of the JtlPendingReports storage queue.");
                    QueueClient queueClient = new QueueClient(storageConnectionString, "JtlPendingReports".ToLower());
                    queueClient.CreateIfNotExists();
                    if (queueClient.Exists())
                    {
                        logger.LogInformation("The JtlPendingReports queue exists.");
                        logger.LogInformation("Checking to see if there are any messages to process.");
                        if ((queueClient.PeekMessages().Value.Length == 0) && !alreadyGotTheResults)
                        {
                            AddResultsToTheQueue(queueClient, storageConnectionString, sqlConnectionString);
                            alreadyGotTheResults = true;
                        }
                        SendResultsToSql(queueClient: queueClient, storageConnectionString: storageConnectionString, sqlConnectionString: sqlConnectionString);
                    }
                    if (!runOnceAndStop)
                    {
                        logger.LogInformation("Hanging out for 15 seconds.");
                        await Task.Delay(15000, commonCancellationToken);
                    }
                }
                logger.LogInformation("All done by by.");
            }
            catch (Exception ex)
            {
                logger.LogError(ex, "Unhandled exception!");
                throw;
            }
            finally
            {
                // Stop the application once the work is done
                _appLifetime.StopApplication();
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        /// delete Queue from Azure Storage account.
        /// </summary>
        /// <returns></returns>
        public static string DeleteQueue()
        {
            QueueClient queueClient = new QueueClient(queue_connection_string, queue_name);
            string      msg         = string.Empty;

            if (queueClient.Exists())
            {
                queueClient.Delete();
            }
            return("Queue delete successfully");
        }
Ejemplo n.º 25
0
        public async void Enqueue(UserInQueueItem item)
        {
            if (!_inQueueClient.Exists())
            {
                throw new InvalidOperationException("User inqueue client does not exist.");
            }

            var message = JsonConvert.SerializeObject(item);

            await _inQueueClient.SendMessageAsync(message);
        }
Ejemplo n.º 26
0
        public QueueWriter(string connectionString, string queueName)
        {
            ParmCheck.NotNullOrEmpty(nameof(connectionString), connectionString);
            ParmCheck.NotNullOrEmpty(nameof(queueName), queueName);

            _queueClient = new QueueClient(connectionString, queueName);

            if (_queueClient.Exists() == false)
            {
                _queueClient.Create();
            }
        }
        static async Task SendArticleAsync(string message)
        {
            QueueClient queueClient = new QueueClient(ConnectionString, "newsqueue");

            await queueClient.CreateIfNotExistsAsync();

            if (queueClient.Exists())
            {
                Console.WriteLine("The queue of news articles was created");
                await queueClient.SendMessageAsync(message);
            }
        }
        public async Task <IActionResult> AddressAndPayment(Order order)
        {
            var formCollection = await HttpContext.Request.ReadFormAsync();

            try
            {
                if (string.Equals(formCollection["PromoCode"].FirstOrDefault(), PromoCode,
                                  StringComparison.OrdinalIgnoreCase) == false)
                {
                    return(View(order));
                }
                else
                {
                    order.Username  = HttpContext.User.Identity.Name;
                    order.OrderDate = DateTime.Now;

                    //Add the Order
                    _db.Orders.Add(order);
                    await _db.SaveChangesAsync(HttpContext.RequestAborted);

                    //Process the order
                    var cart = ShoppingCart.GetCart(_db, HttpContext);
                    cart.CreateOrder(order);

                    // Save all changes
                    await _db.SaveChangesAsync(HttpContext.RequestAborted);

                    try
                    {
                        string      connectionString = Configuration[ConfigurationPath.Combine("ConnectionStrings", "StorageConnectionString")];
                        QueueClient queueClient      = new QueueClient(connectionString, "orders");
                        queueClient.CreateIfNotExists();
                        if (queueClient.Exists())
                        {
                            var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(order.OrderId.ToString());
                            queueClient.SendMessage(System.Convert.ToBase64String(plainTextBytes));
                        }
                    }
                    catch (Exception ex)
                    {
                        return(View("Error"));
                    }

                    return(RedirectToAction("Complete",
                                            new { id = order.OrderId }));
                }
            }
            catch (Exception ex)
            {
                return(View("Error"));
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        /// This Function will dequemsg
        /// </summary>
        public static void DequeueMessageInQueue()
        {
            QueueServiceClient queueServiceClient = new QueueServiceClient(connectionString);
            QueueClient        queueClient        = queueServiceClient.GetQueueClient(queueName);

            queueClient.CreateIfNotExists();

            if (queueClient.Exists())
            {
                QueueMessage[] queueMessages = queueClient.ReceiveMessages();
                queueClient.DeleteMessage(queueMessages[0].MessageId, queueMessages[0].PopReceipt);
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// This Function will read meassage from the queue
        /// </summary>
        public static void PeekMessageFromQueue()
        {
            QueueServiceClient queueServiceClient = new QueueServiceClient(connectionString);
            QueueClient        queueClient        = queueServiceClient.GetQueueClient(queueName);

            queueClient.CreateIfNotExists();

            if (queueClient.Exists())
            {
                PeekedMessage[] peekedMessage = queueClient.PeekMessages();
                Console.WriteLine($"Peeked message: '{peekedMessage[0].MessageText}'");
            }
        }