Azure Service Bus

Azure Service Bus is a messaging service used to connect any applications, devices, and services with any other applications or services and exchange information. It establishes communication between applications and services.

You can consume, publish, and process the Azure Service Bus messages by using Templates/Transactions, and Process Flows. To connect with Azure Service Bus, you need to create an Azure Service Bus account and define Azure Service Bus listener or Azure Service Bus target. 

Creating Azure Service Bus Account 

Azure Service Bus account connects you with Azure Service Bus server. Follow the steps below to create an Azure Service Bus account:

  1. Click Configure > ACCOUNTS > Azure Service Bus.

  2. Click Create Azure Service Bus
  3. On Create Azure Service Bus Account window, enter the following details:

    Field NameDescription
    Name

    A short, descriptive name that helps you re-use this account in future.

    DescriptionA short Description for the Azure Service Bus account.
    Authentication Type

    This field governs the type of authentication you choose to connect to your Azure Service Bus.

    You can select either Shared Access Signatures or Azure Active Directory as the Authentication Type. Based on your selection, the input fields that follow will differ.
    1. Shared Access Signatures: Facilitates non-OAuth based authentication.
      If you select Shared Access Signatures as the Authentication Type, you need to enter Shared Access Key name, Shared Access Key, or Shared Access Signature in the Connection String field to provide connectivity with Azure Service Bus.

    2. Azure Active Directory:  This option facilitates OAuth based authentication and the user experience will be the same as the other OAuth apps.
      If you select Azure Active Directory as the Authentication Type, you need to enter the following details in their respective fields.
      1. Host Name: Hostname of the Azure Service Bus server. For example: "xyzbus.servicebus.windows.net".
      2. Client ID: The client identifier issued to the client during the application registration process.
      3. Client Secret: The client secret issued to the client during the application registration process.
      4. Tenant ID: Tenant Id of the Azure Active Directory.
    Select ProjectSelect the required project in the field.
  4. Click Save to save the Azure Service Bus account.

Azure Service Bus Listener

The Azure Service Bus Listener reads/consumes the messages from a Queue or Topic. You can create Azure Service Bus Listener, and use it in a Template/Transaction or with a Process Flow to consume and process the messages by following the instructions given in the sections below.

Creating and using Azure Service Bus Listener with a Process Flow

Follow the steps given below to create and use Azure Service Bus Listener with a Process Flow. 

The Azure Service Bus Listener created from the manage page is available to be used only in a process flow.

  1. Click Configure > EVENTS > Azure Service Bus Listener.
  2. Click Create Azure Service Bus Listener.
  3. On the Create Azure Service Bus Listener window, enter the following details:

    Field NameDescription
    Name

    A short, descriptive name that helps you re-use this listener in future.

    Description

    A short Description for the Azure Service Bus Listener.

    Azure Service Bus Account

    The account with which you want to associate the listener. You can also click  to add a new account.

    Important tip

    If you have set the Authentication Type as Shared Access Signature while creating the Azure Service Bus account, but the Connection String does not have manage and read claim, the list of topics/queues will not be auto populated in the Topic/Queue field. In this case, you can enter the queue/topic name manually.

    Azure Service Bus Type

    This field that governs the type (Queue, or Topic) of service bus you want to select for processing the messages.

    You can select QUEUE or TOPIC as the Azure Service Bus Type. Based on your selection, the input fields that follow will differ.

    1. If you select TOPIC as the Azure Service Bus Type, you need to select the Topic and the name of the subscription from which you want to receive the messages.
    2. If you select QUEUE as Azure Service Bus Type, you need to select the name of the queue from which you want to receive the messages.
    Session Enable (Optional)

    Service Bus sessions handling option to enable ordered handling of unbounded sequences of related messages. To enable session handling, select the checkbox SessionEnable. If you enable session handling, you need to provide the session Id – An application-defined identifier that's unique to the session – in the next field to join an existing session.

    When sessions are enabled on a queue or a subscription, the client applications can no longer send/receive regular messages. All messages must be sent as part of a session (by setting the session id) and received by accepting the session.
    Process Flow

    The field to select the Process Flow that you want to use for processing the azure service bus messages.

    The Azure Service Bus Listener that you create will be used with the Process Flow that you select in this field. If you are creating the listener from within a Template, this field will not be displayed as the listener will by default be created for the Template.
    PreFetch CountSets the prefetch count of the receiver to speed up the message flow and makes the messages available for local retrieval. Setting a non-zero value will prefetch that number of messages.
    Enable Message Aggregator

    The field that enables aggregation of the messages to be processed. To enable this feature, select the checkbox Enable Message Aggregator. If you enable message aggregator, you need to provide the following information.

    1. Number of Messages for Aggregation: Define the number of messages you want to aggregate. The default value for this field is 0.

    2. Aggregation Timespan: Provide time in seconds for which the received messages will keep on aggregating. The default value for this field is 0.

      Important

      The fields Number of Messages for Aggregation and Aggregation Timespan work in coordination with each other. The messages that a consumer receives are combined into a single message and sent for processing based on the value for these fields, for example:

      1. If Aggregation Timespan is 0 and Number of Messages for Aggregation is 5: the aggregator waits for the receival of 5 messages, irrespective of the time taken to receive those messages. Once 5 messages are received, they are combined into a single message and sent it for processing.
      2. If Aggregation Timespan is 60 seconds and Number of Messages for Aggregation is 0: the consumer keeps receiving the messages until 60 seconds, and then aggregates all the messages received during the time span of 60 seconds. The aggregated messages are combined into a single message and sent for processing.
      3. If Aggregation Timespan is 60 seconds and Number of Messages for Aggregation is 5: the condition that is met first takes precedence. The message aggregation completes when the time span reaches 60 seconds or the number of received messages reach 5. The aggregated messages are combined into a single message and sent for processing.
    3. Message Types: Select the data format – JSON, XML, or PLAINTEXT – of the messages based on which you want to aggregate them.

    4. Message Joiner: Enter the delimiter based on which the messages will be aggregated. It depends on the Message Type.
      • If the Message Type is JSON: Enter an element name. This field can also be left blank.
      • If the Message Type is XML: Enter an XPath.
      • If the Message Type is PLAINTEXT: Enter a delimiter.
  4. Expand the Advanced Properties and enter the email id(s) separated by a comma in the Notification Receiver Email-ID(s) field to receive notifications on message failure.
  5. Select the required project in the Select Project field.
  6. Important

    Once you save the Azure Service Bus Listener, make sure that the following conditions are met to receive the messages.

Creating Azure Service Bus Listeneand using it in a Template

To use Azure Service Bus Listener in a Template, you need to create it from within the Template itself. Follow the steps given below to create Azure Service Bus Listener from within a Template.

You can also allow the Partner to create Azure Service Bus Listener by clicking Partner will define this step check box. The Partner will be able to create Azure Service Bus Listener while creating a Transaction using this Template.

  1. While creating the Template, select Azure Service Bus as a source application.



  2. In the Which event should trigger the data transfer? field, select New Message and click Next.



  3. In the Provide Azure Service Bus account information field, select the Azure Service Bus account and click Next.



  4. On the Azure Service Bus Settings page, provide the information required for each field. For more details refer to this table
  5. Click Next.
  6. Complete rest of the steps in the wizard.

    This creates the Azure Service Bus Listener which is used with the Template to consume and process the messages.

Activating or deactivating the Azure Service Bus Listener

You can activate (turn on) or deactivate (turn off) an Azure Service Bus Listener by toggling  on the Azure Service Bus Listener manage page.

The option to turn the Azure Service Bus Listener ON or OFF is available only for the listener that have been created from the manage page.
  • Once turned on, the listener starts consuming the messages from Azure Service Bus Server and triggers the process flow for processing the received messages.
  • Once turned off, the listener stops receiving Azure Service Bus messages from server. 

Azure Service Bus Target

Azure Service Bus Target sends the messages to Azure Service Bus. You can create Azure Service Bus Target by following the steps given in the following sections and use it in a Template/Transaction or Process Flow.

Creating Azure Service Bus Target and using it in a Process Flow

Steps to create Azure Service Bus Target. 

The Azure Service Bus Target created from the manage page or from within the process flow is available to be used only in a process flow.

  1. Click Configure > TARGETS > Azure Service Bus Target.
  2. Click Create Azure Service Bus Target.

  3. In Create Azure Service Bus Target window, enter the following details:



    Field NameDescription
    Name

    A short, descriptive name to re-use this target in future.

    Description

    A short Description for the Azure Service Bus Target.

    Azure Service Bus Account

    The account with which you want to associate the target.

    Important tip

    If you have set the Authentication Type as Shared Access Signature while creating the Azure Service Bus account, but the Connection String does not have manage and read claim, the list of topics/queues will not be auto populated in the Topic/Queue field. In this case, you can enter the queue/topic name manually.

    Azure Service Bus Type

    The field that governs the type (Queue, or Topic) of service bus you want to select for processing the messages.

    You can select QUEUE or TOPIC as the Azure Service Bus Type. Based on your selection, the input fields that follow will differ.

    • If you select TOPIC as the Azure Service Bus Type, you need to select the Topic through which you want to send the messages.
    • If you select QUEUE as Azure Service Bus Type, you need to select the name of the queue through which you want to send the messages.
    Content Type The content type of the message. The available types are Text/Plain, Application/XML , or Application/JSON.  You can also enter a custom value in this field.
    Correlation ID (Optional)The field for specifying a context for the message for correlation, for example, reflecting the Message-Id of a message that is being replied to.
    The unique identifier for the message and its payload. The value for this field is a free-form string. It can be a GUID or an identifier derived from the application context. Specifying the Message ID of the message prevents the submission of duplicate messages.
    The field to set the subject/label of the message. It indicates the purpose of the message to the receiver in a standardized fashion, similar to an email subject line.
    Reply To (Optional)The field to set the "ReplyTo" address for the message.
    To (Optional)The email address of the message receiver.
    Session ID (Optional)

    Enables joint and ordered handling of unbounded sequences of related messages. You can create/join a session when submitting messages into a topic or queue by setting the Session ID field to some application-defined identifier that's unique to the session. 

    Custom Properties (Optional)

    The field to specify custom properties for the message. To add multiple custom properties, click .

    Enable Message SplitterThe field that enables splitting of the messages based on message type and sending them in batches. To enable this feature, select the checkbox Enable Message Splitter. If you enable message splitter, you need to provide the following information.
    1. Message Type: Select the data format – JSON, XML, or PLAINTEXT – of the messages based on which you want to split them.

    2. Message Splitter: Enter the value for this field based on the selected Message Type.

      • If the Message Type is JSON: Enter an element name. You can also leave this field blank.
      • If the Message Type is XML: Enter an an element name of the record.
      • If the Message Type is PLAINTEXT: Enter a delimiter.
    3. Batch Size: Enter the number of messages you want to be sent in a single batch.

    Select ProjectSelect the required project in the field.

    You can also create Azure Service Bus Target while creating or editing a Process Flow by going to Repository View > Activities > Destination (Target) > AzureServiceBusTarget, and then clicking the icon. 

    This creates the Azure Service Bus Target. Once created, you can use it in a Process Flow as a destination. To achieve this, go to the Process Flow Repository View > Activities > Destination (Target) > AzureServiceBusTarget, and then expand and select the required Azure Service Bus target

Creating Azure Service Bus Target and using it in a Template

To use Azure Service Bus Target in a Template, you need to create it from within the Template itself. Follow the steps given below to create Azure Service Bus Target from within a Template.

You can also allow the Partner to create Azure Service Bus Target by clicking Partner will define this step check box. The Partner will be able to create Azure Service Bus Target while creating a Transaction using this Template.

  1. While creating the Template, select Azure Service Bus as a destination application.



  2. In the Provide Azure Service Bus account information field, select the Azure Service Bus account and click Next.


  3. In the How the data should be delivered to destination? field, select Send Message and click Next.



  4. On the Azure Service Bus Settings page, provide the information required for each field. For more details refer to this table
  5. Click Next.

  6. Complete rest of the steps in the wizard.

    This creates the Azure Service Bus Target which is used with the Template/Transaction to send the messages to Azure Service Bus.

Setting the Event Context Enabled property

Perform the following steps to enable the Event Context Enabled property in the process flow.

  1. Select the Source service and then click View Properties on the context pad menu. 
  2. In the Activity Properties panel, under the GENERAL tab, click the toggle switch to turn on the Event Context Enabled property.
  3. Save the process flow.

Related Topics

Azure Service Bus Listener

Azure Service Bus Target