Using Anypoint Studio to Configure Azure Service Bus Connector 3.1 - Mule 4
Anypoint Studio (Studio) editors help you design and update your Mule applications, properties, and configuration files.
To add and configure a connector in Studio:
If you are new to configuring connectors in Studio, see Using Anypoint Studio to Configure a Connector. If, after reading this topic, you need additional information about the connector fields, see the Azure Service Bus Connector Reference.
Create a Mule Project
In Studio, create a new Mule project in which to add and configure the connector:
-
In Studio, select File > New > Mule Project.
-
Enter a name for your Mule project and click Finish.
Add the Connector to Your Mule Project
Add Azure Service Bus Connector to your Mule project to automatically populate the XML code with the connector’s namespace and schema location and add the required dependencies to the project’s pom.xml
file:
-
In the Mule Palette view, click (X) Search in Exchange.
-
In Add Modules to Project, type
azure service bus
in the search field. -
Click Azure Service Bus in Available modules.
-
Click Add.
-
Click Finish.
Adding a connector to a Mule project in Studio does not make that connector available to other projects in your Studio workspace.
Configure an Input Source
An input source initiates a flow when a specified condition is met. You can configure one of these input sources to use with Azure Service Bus Connector:
-
Message Listener
Receives messages from the specified queue or subscription -
HTTP Listener
Initiates a flow each time it receives a request on the configured host and port -
Scheduler
Initiates a flow when a time-based condition is met
For example, to configure Message listener, follow these steps:
-
In the Mule Palette view, select the Azure Service Bus Connector, then select Message listener.
-
Drag Message listener to the Studio canvas.
-
On the Message listener configuration screen, optionally change the value of the Display Name field.
-
From Acknowledgment mode, select from these options:
-
Auto
Automatic acknowledgment of the received message only if the application flow executes successfully -
Immediate
Automatic acknowledgment of the message once it is consumed and prior to any processing of the message -
Manual
Delegates the responsibility for acknowledging the message to the application logic
-
-
In the Destination section, enter:
-
Destination name
Name of the destination queue from which messages are received -
Subscription name
Name of the subscription from which messages are received
-
-
Click the plus sign (+) next to the Connector configuration field to configure a global element that can be used by all instances of Message listener in the app.
Add a Connector Operation to the Flow
When you add a connector operation to your flow, you immediately define a specific operation for that connector to perform.
To add an operation for Azure Service Bus Connector, follow these steps:
-
In the Mule Palette view, select Azure Service Bus and then select the desired operation.
-
Drag the operation onto the Studio canvas to the right of the input source.
Configure a Global Element for the Connector
When you configure a connector, it’s best to configure a global element that all instances of that connector in the app can use. Configuring a global element requires you to provide the authentication credentials the connector uses to access the target Azure Service Bus Messaging system.
Azure Service Bus Connector supports SAS (shared access signature) authentication.
To configure the global element for Azure Service Bus Connector, follow these steps:
-
Select the name of the connector in the Studio canvas.
-
In the configuration screen for the operation, click the plus sign (+) next to the Connector configuration field to access the global element configuration fields.
-
On the General tab, configure the following required fields for SAS authentication:
-
Enter the Azure Service namespace.
This is the unique name assigned to the namespace when it was created and is the host-name portion of the URL, for example:https://{serviceNamespace}.servicebus.windows.net/{path}
The following screenshot shows an example of configuring SAS authentication for Azure Service Bus Connector:
Figure 1. SAS authentication fields -
Enter the Azure Shared access key name.
This is the name of the SAS token configure in the Azure Service Bus namespace. -
Enter the Azure Shared access key.
This is the name of your SAS token.You can reference a configuration file that contains ANT-style property placeholders (recommended), or you can enter your authorization credentials in the global configuration properties. For information about the benefits of using property placeholders and how to configure them, see Anypoint Connector Configuration.
-
-
On the Advanced tab, optionally specify reconnection information, including a reconnection strategy.
-
Click Test Connection to confirm that Mule can connect with the specified server.
-
Click OK.
Azure Service Bus Connector cannot perform a connectivity test at startup using the Test Connection button in the global element of the connector configuration when you restrict access to your resources and you have a security policy with permissions at the resource level only. This is because the security policy targets the root level of the namespace, which might be forbidden due to the customized policy applied to the shared access key.
|
View the App Log
You can view the app log as follows:
-
If you’re running the app from the Anypoint Platform, the output is visible in the Anypoint Studio console window.
-
If you’re running the app using Mule from the command line, the app log is visible in your OS console. Unless the log file path was customized in the app’s log file (
log4j2.xml
), you can also view the app log in this default location:MULE_HOME/logs/<app-name>.log
For more information about the app log, see Configuring Logging.
Reduce Excessive Logging
When using the Message Listener source, the Azure Service Bus library emits an INFO-level log message approximately every 30 seconds, indicating that no new messages were received. To avoid this excessive logging, add the following AsyncLogger element to the log4j.xml
file:
<AsyncLogger name="com.microsoft.azure.servicebus.primitives.CoreMessageReceiver" level="WARN"/>