TECHNICAL BLOG

Service Bus queues and storage queues

Two Azure services include message queues: Service Bus and Azure Storage. As a general guide, storage queues are simpler to use, but they're less sophisticated and less flexible than Service Bus queues. The key advantages of Service Bus queues include:

Supports larger messages sizes of 256 KB (standard tier) or 100 MB (premium tier) per message versus 64 KB for Azure Storage queue messages.
Supports both at-most-once and at-least-once delivery. Choose between a very small chance that a message is lost or a very small chance it's handled twice.
Guarantees first-in, first-out (FIFO) order. Messages are handled in the same order they're added. Although FIFO is the normal operation of a queue, the default FIFO pattern is altered if the organization sets up sequenced or scheduled messages or during interruptions like a system crash.
Can group multiple messages in one transaction. If one message in the transaction fails to be delivered, all messages in the transaction aren't delivered.
Supports role-based security.
Doesn't require destination components to continuously poll the queue.

Advantages of storage queues:

Supports unlimited queue size (versus 80-GB limit for Service Bus queues)
Maintains a log of all messages

How to choose a communications technology

You've seen the different concepts, and the implementations Azure provides. Next, consider what your decision process should look like for each of your communications.


Considerations

As you choose a method for sending and receiving messages, consider the following questions:

Is the communication an event? If so, consider using Event Grid or Event Hubs.
Should a single message be delivered to more than one destination? If so, use a Service Bus topic. Otherwise, use a Service Bus queue.

Queues: Service Bus vs. storage

If you decide that you need a queue, narrow down your choice further. Choose a Service Bus queue if:

You need an at-most-once delivery guarantee.
You need a FIFO guarantee (if no other settings pre-empt the default FIFO order).
You need to group messages into transactions.
You want to receive messages without polling the queue
You need to provide role-based access to the queues.
You need to handle messages larger than 64 KB but smaller than 256 KB for the standard tier or 100 MB for the premium tier.
Your queue size won't grow larger than 80 GB.
You'd like to be able to publish and consume batches of messages.

Choose a storage queue if:

You need a simple queue with no particular extra requirements.
You need an audit trail of all messages that pass through the queue.
You expect the queue to exceed 80 GB in size.
You want to track progress for processing a message inside the queue.

Conclusion

Although the components of a distributed application can communicate directly, you often can increase that communication's reliability by using an intermediate communication platform like Azure Event Hubs or Azure Event Grid.
Event Hubs and Event Grid are designed for events, which notify recipients only of an event and don't contain the raw data associated with that event. Azure Event Hubs is designed for high-flow, analytics types of events.
Azure Service Bus and storage queues are for messages, which you can use for binding the core pieces of any application workflow.
If your requirements are simple, if you want to send each message to only one destination, or if you want to write code as quickly as possible, a storage queue might be the best option. Otherwise, Service Bus queues provide many more options and flexibility. If you want to send messages to multiple subscribers, use a Service Bus topic.


Azure Logic Apps Explained

Azure Logic Apps is a cloud-based service that enables you to automate workflows and integrate apps, data, and services across different systems. It provides a visual interface to design workflows, known as "logic apps," which can be triggered by various events and can integrate with a wide range of systems using pre-built connectors.

Key Concepts of Azure Logic Apps:

Triggers: A trigger starts a logic app. It could be a time-based trigger (e.g., every hour), an event (e.g., when a file is uploaded), or an action in another system (e.g., receiving an email).
Actions: Actions are the steps that the logic app performs after it is triggered. These can include calling APIs, manipulating data, sending emails, etc.
Connectors: Connectors allow logic apps to interact with various services, such as Office 365, Salesforce, Azure services, databases, etc.

Example Scenario: Automating Invoice Processing

Let’s say you want to automate the process of receiving invoices via email, saving them to a SharePoint document library, and then notifying the accounting team.

Steps to Implement This Workflow Using Azure Logic Apps:

  1. Create the Logic App In the Azure portal, create a new Logic App by navigating to Create a resource > Integration > Logic App.

  2. Give it a name, select a resource group, and click Create. Design the Workflow

    • Step 1: Add a Trigger Trigger: Choose the trigger to start your logic app. In this case, you might choose When a new email arrives (V2) from the Office 365 Outlook connector. Condition: Set conditions to filter emails. For instance, you might only want to trigger the workflow when the subject contains "Invoice."

    • Step 2: Extract Invoice Attachment Action: Use the Get attachments action to retrieve any files attached to the email.

    • Step 3: Save the Attachment to SharePoint Action: Add a Create file action from the SharePoint connector. Configure it to save the attachment to a specific document library in SharePoint. Set the file name and content based on the email attachment.

    • Step 4: Notify the Accounting Team Action: Use the Send an email (V2) action from the Office 365 Outlook connector to send a notification email to the accounting team. The email can include details like the sender’s email address, the subject of the email, and a link to the saved file in SharePoint.

  3. Test and Monitor the Logic App Test: Send an email with an invoice attachment to see if the logic app correctly processes it. Monitor: Azure Logic Apps provides built-in monitoring tools. You can see the run history and inspect any errors that occurred during the execution.

  4. Enhance the Workflow Error Handling: Add error handling actions like Scope and Terminate to manage what happens if a step fails (e.g., retry, log the error).
    Data Transformation: Use data operations like Compose or Parse JSON to transform or extract specific information from the email content or attachment.
    Approval Workflow: You can add an approval step where the accounting team reviews the invoice before it is saved to SharePoint.

    Final Workflow Overview

    Trigger: The workflow starts when an email with the subject "Invoice" is received.
    Get Attachments: The attachment(s) from the email are retrieved.
    Save to SharePoint: The attachment is saved to a designated SharePoint document library.
    Notify Team: An email notification is sent to the accounting team, including details of the invoice.

    Benefits of Using Azure Logic Apps:

    No-Code/Low-Code Solution: Allows non-developers to create complex workflows using a visual designer.
    Scalability: Automatically scales with demand, processing multiple workflows concurrently.
    Integration: Easily integrates with hundreds of services and on-premises systems.
    Cost-Effective: Pay only for what you use, with a straightforward pricing model based on the number of actions executed.

Summary

Azure Logic Apps is a powerful tool for automating business processes and integrating systems. By creating a simple workflow, you can automate tasks such as invoice processing, saving time and reducing the potential for human error. With its extensive library of connectors and easy-to-use interface, Azure Logic Apps is suitable for both technical and non-technical users.

The perfect choice for Entrepreneur, business advisor and corporates.