Microsoft Azure Storage and Database Part 29 – Azure Queue Storage – Store And Process Messages In Azure Queue
Hope you all are doing good !!! 🙂 .
In our previous article we have discussed on Overview Of Azure Queue Storage. Today in this article we will see how can we Store And Process Messages In Azure Queue.
Tool Installation Articles :
- Configure Azure Command Line Interface ( Azure CLI) On Windows
- Configure PowerShell For Microsoft Azure Az Module On Windows
Previous Azure Series :
- Learn Basics Of Azure Networking In 60 Hours
- Learn Basic Of Azure Active Directory And Azure Identity And Access Management
- Azure DevOps – Learn at one place
If you have missed our previous articles on Azure Storage and Database Series, please check it in following links.
Azure Queue Storage
As we know Azure Queue Storage provides cloud messaging between application components. In this article we will implement following use case based on Azure Queue.
Use case :
There will be one Queue, where messages are coming from a different application. The messages should be processed and do the following tasks
- Create a new text file in Blob storage and the name should be same as message name.
- Create a new message in another Queue for processed message from the first queue.
- Delete the processed message from first Queue.
Required Resources :
Manas-Queue :The first Azure Queue, where the messages are coming from outside.
Processed-Message Queue :The second Azure Queue, which store notification for processed message
Manas Blog Container: The blob container, where the text file to be create after processing the message.
Logic App :The logic app which will process the messages.
Create Azure Queue :
As described in the above section, first we need two Azure Queues. We have already one Azure Queue (manas-queue) for storing message from out side as sharing in the following figure.
Let’s create the second Queue as described in the following steps.
Step 1 – Log-in to Azure portal and select the Storage account where we want to create our second Azure Queue (
Processed-Message), which will store notification of processed messages.
Step 2 – From storage account page, select Queues under Data storage section of left menu.
As showing in the above figure, currently we have our first queue and now we are going to create a new Queue by clicking +Queue button from top.
Step 3 – Provide the name of the Queue and click OK to create the Azure Queue.
Create Logic App
As per the above section, we need to add a Logic app, which will process all message and create blob file for each message as per the use case. We need to create a new Logic app as in following steps.
Step 1 – Let’s find Logic apps from Azure Marketplace and select Logic apps, which lists all the existing Logic app.
Step 2 – To add a new Logic App, click +Add link as showing in the following figure and select + Consumption.
Step 3 – After providing required information click Review + Create and then and click Create to crate the Logic app.
Step 4 – Let’s configure the new Logic app (File-creator), once it is created. To configure it select a Blank Logic app template.
Step 5 – Now let’s add the actions as per our requirement. But before that we need to select one option to trigger the workflow. Here as showing in the following figure , I am triggering the app when there are messages in manas-queue.
Step 6 – Once we configured the triggering option, we need to add one by one our actions. As per our requirement first, we need to configure our action to read messages from our first queue (manas-queue) as showing in the following figure.
Step 7 – Now the next action would be to create one blob for each message we are processing. So add create blob action and configure the required fields as showing in the following figures.
Step 8 – Now we need to configure one more action, which will create a new message for each processed message. After that add one new action to delete the processed message from it’s original queue as showing in the following figures.
After configure all action, the design of the Logic app will be looks like the above figure.
in the following figure we can see, we have some messages in our first queue.
So as per the Logic app configuration and configured workflow. It will start checking the Manas-queue in every 15 second interval and process the messages, if there is any message.
We can see in the following figures, blogs are getting created for each message and also notification sent for each processed messages.
As per the requirement, the app should delete the processed messages from the Manas-Queue queue and as we can see int eh above figure, it deleted all processed message.
Same way we can use this service for different use cases.
With the above information, I am concluding this article. I hope this is informative to you. Please let me know if I missed anything important or if my understanding is not up to the mark. Keep reading, share your thoughts, experiences. Feel free to contact us to discuss more.
If you have any suggestion / feedback / doubt, you are most welcome. Stay tuned on Knowledge-Junction, will come up with more such articles.
Thanks for reading 🙂 .