Azure Service Bus : A Reliable Messenger for Microsoft Dataverse

Data is essential to the business world, but data communication is equally important, as accurate data conveys important information about the business process and those data can be useful and effective, even giving it an advantage in business competitiveness. That's why business believes in data communication with accuracy. The communication between a computer and a software application is called Messaging.

Messaging is a method of communication between software components or applications.

Although there are many types of communication support by Microsoft Dataverse, event driven is important. In the previous article (Webhook: A Unidirectional Business Event), I talked about webhook, which communicate on an event basis. In the article, I am going to describe about Azure Service Bus.

Microsoft Azure Service Bus is a cloud based Messaging as a Service  (MaaS) platform.

When I started learning about Azure Service Bus, the first question that came to my mind. What is the use of this feature? And the second question came, how influential is it with the Microsoft Dataverse. For answer, I will share below two scenarios:

Scenario 1:

An e-commerce business takes orders from customers and delivers products after due payment. As is known, order carrier and payment carrier are two different modes of activities. In this process, the payment gateway providers place the requests in a proper queue and live until the payment is done properly and verifies the order processing about the completion of this activity.

Scenario 2:

Generally, an application communicates to multiple applications and service providers. For communication, they create different communication channels, that means they store credentials and establish a proper connection. To calculate the connection, developers use the below formula :

Connection = n(n-1)/2

In this way, if an application communicates with 10 applications, it will make 45 connections with each other. Therefore, Azure Service Bus provides a way for everyone to align their business communications with a single connection.


Microsoft Azur Service Bus is a fully managed enterprise message broker that will deliver message as message queue or publish-scribe topics.  It decouples the applications and services from each other. It is a high-performance, real-time and fault-tolerant service that transfers messages between applications. It can connect to any application, services or device running in the cloud and establish or seamlessly receive communication with other applications, services.

Basic features:

  • To receive message without having to poll the queue.
  • To provide a guaranteed First- in First-Out ordered delivery.
  • To support automatic duplicate detection.
  • To process messages as parallel long- running streams.
  • To require transactional behavior and atomicity.
  • To handle messages that can exceed 64KB but won't likely approach the 256 KB limit.

Microsoft Azure Service Bus does not work in synchronizing sender and receiver. It keeps the message in the queue until the consumer consumes it or terminates itself. Its main agenda is to facilitate communication between two or more parties as a communication facility when they wish to exchange information with each other. Data transferred between different applications and services can be any type of information, including structured plain text, data encoded in standard formats such as JSON, XML, etc.

Microsoft Dataverse and  Azure Service Bus:

There is pre-built mechanism for integration with Azure Service Bus in the Microsoft Dataverse which can be easily found in the Plug-in Registration Tool. The Azure Service Bus provides a secure and reliable communication channel between Dataverse runtime data and external cloud-based line-of-business (LOB) applications. 



Data Context:

The Data Context is key player which contains the business data that is being processed as part of the current Dataverse operation. The data context is passed to any plug-ins or custom workflow activities that are registered with the event pipeline to execute on the specific request and table combination that is currently being processed. The data context is of type IPluginExecutionContext when it is being passed along the event execution pipeline and RemoteExecutionContext when it is posted to the Service Bus. The data context contained within the message that is posted to the Azure Service Bus can be formatted in XML or JSON in addition to the default .NET binary format. 

There are two method where Data Context can be processed:

  • Plugin
  • Workflow Extension

Plugin:

Plug-ins are one of two methods used to initiate posting the message containing the data context to the Azure Service Bus:
  • Azure Aware OOB Plugin
  • Custom Plugin 

Azure Aware OOB Plugin:

An Azure-aware OOP plugin is available in the Plugin Registration tool where developers can register Azure Service Bus Endpoint. This plugin executes in full trust with Dataverse Platform and Developers must register a plugin step in the event execution pipeline that identifies the message and table that triggers the plug-in to execute and perform the posting notification.

Custom Plugin 

Developers can write won custom Azure aware custom plugin. The custom plug-in executes in partial trust mode in the sandbox. A custom plug-in can initiate posting of the data context to the service bus through the service endpoint notification service. Adding code to invoke this service makes the plug-in “Azure-aware”.

Workflow Extension:

A workflow is a powerful tool that provides a series of sequential methods (commonly called steps) that help with the management of data and processes. Workflow Extensions provide developers with a way to change workflow behavior. Similar to plug-ins, custom workflow activities can be written to initiate posting of the current request message data context to the Azure Service Bus by using the Service Endpoint Notification Service (IServiceEndpointNotificationService).

Summary:

Microsoft Dataverse provides various in-built mechanism for external data for integration. Azure Service Bus provides a secure and reliable communication channel between Microsoft Dataverse runtime to one or more Azure solution in the cloud environments.

Comments

Popular posts from this blog

PCF vs. Web Resources: Choosing the Right Extensibility Tool for Dataverse

Is Debt Prosperity or Trap?

Exam PL-400: Microsoft Power Platform Developer