Azure Storage - Get Messages
Declaration
<AMAZURESTORAGE ACTIVITY="get_all_message" ACCOUNTNAME="text" ACCESSKEY="text (encrypted)" PROTOCOL="text (options)" TIMEOUT="number" BLOBENDPOINT="text" QUEUEENDPOINT="text" TABLEENDPOINT="text" PROXYTYPE="text (options)" PROXYSERVER="text" PROXYPORT="number" PROXYUSERNAME="text" PROXYPASSWORD="text (encrypted)" QUEUE="text" RESULTDATASET="text" VISIBILITY="number" DELETE="YES/NO" FOLDER="text" SAVEMODE="text (options)" />
Description: Retrieves all queue messages and populates a dataset with results.
Practical Usage
Commonly used to archive queue messages before deleting them from the queue.
Connection Parameters
Property |
Type |
Required |
Default |
Markup |
Description |
---|---|---|---|---|---|
Connection |
|
|
|
|
Indicates where user credentials and preferences should originate from. This is a design mode parameter used only during task construction and configuration, thus, comprises no markup. The available options are:
|
Session |
Text |
Yes if connection is session-based |
AzureStorageSession1 |
SESSION="MyAzureSession" |
The name of an existing session to associate this activity with. This parameter is active only if the Connection parameter is set to Session. The default session name is 'AzureStorageSession1'. |
Account name |
Text |
Yes if connection is host-based |
(Empty) |
ACCOUNTNAME="myaccount" |
The globally unique name of the Windows Azure storage account. This parameter is active only if the Connection parameter is set to Host. |
Access key |
Text |
Yes if connection is host-based |
(Empty) |
ACCESSKEY="[AccessKey]" |
The primary or secondary access key (each composed of 88 ASCII characters) used to authorize access to Azure Storage. This parameter is active only if the Connection parameter is set to Host. |
Protocol |
Text (options) |
No |
HTTPS |
|
The type of protocol used to access Azure Storage. The available options are:
|
Timeout (seconds) |
Number |
No |
90 |
TIMEOUT="180" |
The timeout interval (in seconds) for requests made to the storage service. If the timeout elapses before a server response is returned, the operation times out and the service returns an error. The default timeout value is 90 seconds. |
Blob endpoint URI |
Text |
No |
(Empty) |
BLOBENDPOINT="http:// accnt
.blob.core.windows.net" |
The endpoint for the Blob service, as configured for the Azure Storage account. The default Blob service endpoint is'[http/https]://accountname.blob.core.windows.net',where 'accountname' is the name of the Azure Storage account. |
Queue endpoint URI |
Text |
No |
(Empty) |
QUEUEENDPOINT="http:// accnt
.queue.core.windows.net" |
The endpoint for the Queue service, as configured for the Azure storage account. The default Queue service endpoint is '[http/https]://accountname.queue.core.windows.net' , where 'accountname' is the name of the Azure Storage account. |
Table endpoint URI |
Text |
No |
(Empty) |
TABLEENDPOINT="http:// accnt
.table.core.windows.net" |
The endpoint for the Table service, as configured for the Azure storage account. The default Table service endpoint is ' Property |
Queue name |
Text |
Yes |
(Empty) |
SESSION="myPDFseesion" |
The unique name of the storage queue that contains the messages to retrieve. |
Create and populate dataset with message information |
Text (options) |
Yes |
(Empty) |
RESULTDATASET="theMessage" |
The name of the dataset to create and populate with information about the messages to retrieve. See Datasets below for more details. |
Visibility timeout (seconds) |
Text |
No |
(Empty) |
VISIBILITY="1000" |
After a message has been retrieved, it is reserved for deletion until the interval entered in this parameter has surpassed and no other client may retrieve the message during this period. If the message is not deleted before the time specified, it again becomes visible to other clients. |
Delete |
Yes/No |
No |
Yes |
DELETE="yes" |
If set to YES (default), specifies that the messages will be deleted rather than becoming visible. If set to NO, messages are not deleted, instead, they again become visible to other clients. |
Save messages in folder |
Text |
No |
(Empty) |
FILE="c:\temp\" |
If the corresponding check box is enabled, specifies a valid path and folder name in which to store messages and their contents. If disabled, messages and their contents will not be stored locally. |
If filename already exists |
Text (options) |
No |
Do not save |
|
If set to YES, any matching file names that exist in the destination folder will be overwritten. If set to NO (default), matching file names will not be overwritten, however, an error will occur as a result. |
Description tab - A custom description can be provided on the Description tab to convey additional information or share special notes about a task step.
Error Causes tab - Specify how this step should behave upon the occurrence of an error. (Refer to Task Builder > Error Causes Tab for details.)
On Error tab - Specify what AWE should do if this step encounters an error as defined on the Error Causes tab. (Refer to Task Builder > On Error Tab for details.)
Datasets
A dataset is a multi-column, multi-row object that contains a collection of information gathered during runtime and stored in memory. This activity creates and populates a dataset with the following fields (rows):
Name |
Type |
Return Value |
---|---|---|
theDataset.DequeueCount |
Number |
The number of times this message has been de-queued. When a message is retrieved for the first time, its DequeueCount property is set to 1. If it is not deleted and is subsequently retrieved again, the DequeueCount property is incremented. |
theDataset.ExpirationTime |
Text |
The date/time that the message expires. |
theDataset.Id |
Text |
The unique ID of the message. |
theDataset.InsertionTime |
Date |
The date/time that the message was initially added to the queue. |
theDataset.NextVisibleTime |
Date |
The next date/time that the message will be available to be read, if it is not deleted at the time it was retrieved. |
theDataset.PopReceipt |
Text |
Indicates that the message has been read and is used to verify that the message being deleted is the same one that was retrieved. |
theDataset.Text |
Text |
The message that was retrieved. |
Example
The sample AML code below can be copied and pasted directly into the Steps panel of the Task Builder.
Description: This sample task creates an Azure storage session, retrieves all messages from a specified queue and populates a dataset with results. It then loops through the dataset of retrieved queue messages and deletes a message with a specific ID/POP receipt. An End session activity marks the end of the session as well as the task.
<!-- Create session -->
<AMAZURESTORAGE ACTIVITY="create_session" ACCOUNTNAME="netauto2004" ACCESSKEY="AM2rpq73bKmXN7UmqHdyKZZ3qCai N3apmzen5q83eWmU967mr7d7aZs3oma592opmjeiZqF3eymLN60mpTdtaZu3oiam N3Upk/ev5qb3eCmK96Vmq7dzqZO3pyant3vplfeq5q23fGmYN7HmuPdyqZZ3tyajt3 UpnHevJqg3femed6impnd7KZ+3r2aht3pplnevJr43aimat7Ymvvd4aZz3sOai93 KpmjepJq73b6mJd7smszdg6YY3g==aME" PROTOCOL="http" SESSION="myQueueSession" />
<!-- Get all messages from queue -->
<AMAZURESTORAGE ACTIVITY="get_all_message" QUEUE="myqueue" RESULTDATASET="theDataset" DELETE="no" PROVIDER="session_based" SESSION="myQueueSession" />
<!-- Loop dataset -->
<AMLOOP ACTIVITY="dataset" DATASET="theDataset">
<!-- Delete message with specific ID/Pop receipt -->
<AMAZURESTORAGE ACTIVITY="delete_message" QUEUE="myqueue" ID="3b402357-2f5c-4b10-ae71-d9aca57e3f4e" POSTRECEIPT="AgAAAAEAAACzOQAALzOCMJGkzAE=" PROVIDER="session_based" SESSION="myQueueSession" />
<!-- End loop -->
</AMLOOP>
<!-- End session -->
<AMAZURESTORAGE ACTIVITY="end_session" SESSION="myQueueSession" />