Official Content

The MessageQueueProvider is an external object of the Queue API located under AzureQueue module. 
It allows establishing a connection to an Azure Storage Queue

To send or receive messages from Azure Queue, first you have to establish a connection using the method of this external object. It returns a MessageQueue, which must be used to process the queue (issue and consume messages).

This guarantees that only the Azure Queue dependencies are downloaded to your machine and taken to deployment.

image_202382518248_1_png

Summary

Properties

It doesn't have any.

Methods

Connect

Static method that allows connecting to Azure Storage Queue using a connection string.

Return value  MessageQueue
Parameters   queueName:VarChar, connectionString:VarChar, errorMessages:Messages, success: Boolean.

connectionString should include the authentication information required for your application to access data in an Azure Storage account at runtime.
It should be extracted from the Azure portal, by going through the storage account -> Access Keys menu option. 

Authenticate 

Static method to authenticate to Azure Storage Queue using passwordless authentication (e.g. Managed identity).

Return value  MessageQueue
Parameters   queueURI:VarChar, queueURL:VarChar, errorMessages:Messages, success: Boolean.

queueURI is an Uri referencing the queue that includes the name of the account, and the name of the queue. This is likely to be similar to "https://{account_name}.queue.core.windows.net/{queue_name}".

Applications can use managed identities to obtain Azure AD (Microsoft Entra ID) tokens without having to manage any credentials. As Azure documents explain, it is recommended that apps use token-based authentication rather than connection strings when authenticating to Azure resources.

The implementation chains several Token Credential implementations to be tried in order until one succeeds:

  • System-assigned Managed Identity
    Attempts authentication using a managed identity assigned to the deployment environment. This authentication type works for all Azure-hosted environments that support managed identity.
     
  • User-assigned Managed Identity.
    The resource ID to authenticate for a user-assigned managed identity must be set in an environment variable named "AZURE_CLIENT_ID".
     
  • Service Principal. Enables authentication to Azure Active Directory (Microsoft Entra ID) using a client secret or certificate, or as a user with a username and password. See here for more details.
     
  • Azure CLI credentials
    Enables authentication to Azure Active Directory using Azure CLI to obtain an access token (for development environments).

Events

It doesn't have any.

Set connection at runtime using environment variables

Environment variables (encrypted if desired) can be set to indicate connection parameters, instead of passing the values to the methods.

In most cases, it is useful to change the connection at runtime.
First, the environment variables are read and then the value of the parameter passed to the method is taken into account.

The variables may or may not be encrypted. The encryption key should be indicated in the Application.key file in the case of the NET generator.
In Azure, the environment variables are set as App Settings.

The enviroment variables for the methods explained in this document are the following:

  • QUEUE_AZUREQUEUE_QUEUENAME
  • QUEUE_AZUREQUEUE_CONNECTIONSTRING
  • QUEUE_AZUREQUEUE_QUEUEURI

 

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant