DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Configuring a Shopify MuleSoft Connector
  • Handle HL7 MLLP Messages With Mule 4
  • SharePoint Integration With MuleSoft
  • Configuring Amazon S3 Using Mulesoft

Trending

  • Unlocking AI Coding Assistants Part 2: Generating Code
  • My LLM Journey as a Software Engineer Exploring a New Domain
  • The 4 R’s of Pipeline Reliability: Designing Data Systems That Last
  • The Modern Data Stack Is Overrated — Here’s What Works
  1. DZone
  2. Coding
  3. Tools
  4. Using the Microsoft Service Bus Connector With Mulesoft

Using the Microsoft Service Bus Connector With Mulesoft

The service bus connector in Mule enables message integration with Windows Service Bus on-premise as well as with Azure Service Bus on the cloud.

By 
Jitendra Bafna user avatar
Jitendra Bafna
DZone Core CORE ·
Updated May. 10, 17 · Tutorial
Likes (5)
Comment
Save
Tweet
Share
10.2K Views

Join the DZone community and get the full member experience.

Join For Free

This connector supports the communication with queues, topics, and EventHubs through AMQP 1.0.

Features of Service Bus Connector

  • Send messages to queues, topics, and EventHubs with the support of AMQP.

  • Receive from queues and topic asynchronously.

  • Supports Windows Service Bus on-premise as well as Azure Service Bus on the cloud.

  • Rest management API like CRUD for queues, topics, subscriptions, and rules.

First, go through my article on how to create a service bus with Windows Azure. This article will give you a brief idea on how to create queues and topics in Azure cloud.

Now, we will walk through how to send and receive messages from the Windows Azure Service Bus queue.

Send Messages to the Windows Azure Service Bus Queue

Place the HTTP listener into the canvas and click to open the Properties console.

Click the green + and configure as follows:

  • Host: localhost.

  • Port: 8081.

  • Method: POST.

  • Path: servicebus.

Image title

Search and drag the Microsoft Service Bus Connector into the canvas. If the Microsoft Service Bus Connector is not found, then install it from Anypoint Exchange.

Click on the green + to configure the Microsoft Service Bus Connector.

Image title

Select Microsoft Service Bus: Azure Service Bus.

Image titleProvide Service Name, Shared Access Key Name, and Shared Access Key. Then, you can get it from the Windows Azure Service Bus connection information.

Image title

Perform the test connection and press OK.

Select Operation Queue send and provide the destination queue name.

Image title

Test the Application

You can use Postman to send the request to Mule flow and Mule flow will send a message to the Azure Service Bus queue. The URL is http://localhost:8081/servicebus.

Image titleYou can verify in the Azure Service Bus queue whether the message was received.

Image title

Code:

<?xml version="1.0" encoding="UTF-8"?>
<mule
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:microsoftservicebus="http://www.mulesoft.org/schema/mule/microsoftservicebus"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/microsoftservicebus http://www.mulesoft.org/schema/mule/microsoftservicebus/current/mule-microsoftservicebus.xsd">
<microsoftservicebus:azureConfig name="Microsoft_Service_Bus__Azure_Service_Bus" namespace="" userName="" password="" doc:name="Microsoft Service Bus: Azure Service Bus"/>
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<flow name="servicebusflowFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/servicebus" allowedMethods="POST" doc:name="HTTP"/>
<microsoftservicebus:queue-send config-ref="Microsoft_Service_Bus__Azure_Service_Bus" destinationQueue="muletestqueue" doc:name="Microsoft Service Bus"/>
<set-payload value="Message Sent to Queue" doc:name="Set Payload"/>
</flow>
</mule>

Receive Messages From the Windows Azure Service Bus Queue

Search and drag the Microsoft Service Bus Connector in the message source area of the canvas. Configure in the same way as we have done above.

Select Operation Queue receive and provide the source queue.

Image title

This is how you can receive a message from the Azure Service Bus queue:

<?xml version="1.0" encoding="UTF-8"?>
<mule
xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:microsoftservicebus="http://www.mulesoft.org/schema/mule/microsoftservicebus"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/microsoftservicebus http://www.mulesoft.org/schema/mule/microsoftservicebus/current/mule-microsoftservicebus.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd">
<microsoftservicebus:azureConfig name="Microsoft_Service_Bus__Azure_Service_Bus" namespace="" userName="" password="" doc:name="Microsoft Service Bus: Azure Service Bus"/>
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<flow name="servicebusflowFlow">
<microsoftservicebus:queue-receive config-ref="Microsoft_Service_Bus__Azure_Service_Bus" sourceQueue="muletestqueue" doc:name="Microsoft Service Bus"/>
<file:outbound-endpoint path="src/test/resources/out" responseTimeout="10000" doc:name="File"/>
</flow>
</mule>

Similarly, you can configure the service bus topic to receive and send messages.

Now, you know how to send and receive messages from Azure Service Bus queue with Mulesoft.

Here is the video tutorial.


Connector (mathematics) azure MuleSoft

Opinions expressed by DZone contributors are their own.

Related

  • Configuring a Shopify MuleSoft Connector
  • Handle HL7 MLLP Messages With Mule 4
  • SharePoint Integration With MuleSoft
  • Configuring Amazon S3 Using Mulesoft

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: