Nav

Microsoft Service Bus Connector

Select

The ServiceBus connector enables message integration with Windows Service Bus on-premises and Azure Service Bus on the cloud. The connector supports communication with queues, topics, and event hubs through AMQP 1.0. In addition, dynamic discovery and provisioning of Service Bus objects is possible using the built-in management API.

Prerequisites

This document assumes that you are familiar with Mule, Anypoint Connectors, Anypoint Studio, Mule concepts, elements in a Mule flow, and Global Elements.

You need credentials to test your connection to your target resource. It can be one of the following credentials type:

  • SAS (Shared Access signature)

  • Username and Password

  • Windows credentials type

For hardware and software requirements and compatibility information, see the Connector Release Notes.

To use this connector with Maven, view the pom.xml dependency information in the Dependency Snippets in Anypoint Exchange.

The connector supports the following Service Bus versions:

  • Microsoft Azure Service Bus (Cloud)

  • Microsoft Windows Service Bus (on-premises)

What’s New in this Connector

Added support for Mule 4.

To Connect in Design Center

Operations

  1. In Design Center, click a trigger such as an HTTP Listener or Scheduler.

    Trigger options

  2. To create an HTTP global element for the connector, set these fields:

    HTTP Listener configuration

    • Protocol: Protocol selected for the HTTP endpoint, it can be HTTP or HTTPS (secure).

    • Host: IP address where your Mule application listens for requests.

    • Port: Port address where your Mule application listens for requests.

    • Base Path: path where your Mule application listens for requests.

  3. Select the plus sign to add a component.

    add connector

  4. Select the connector as a component.

  5. Configure one of Global elements for the connector:

    • Configuration

      Configuration

      General

      Field

      Description

      Connection Type

      The type of connection: Shared Access Signature, Username and Password or Windows.

      Encoding

      The default encoding of the Message body to be used if the message doesn’t communicate it.

      Content Type

      The default contentType of the Message body to be used if the message doesn’t communicate it.

      Ack Mode

      The Session ACK mode to use when consuming a message.

      Consumer Type

      The ConsumerType to be used by default when consuming a Message Can be overridden at the message source level.

      Selector

      Default JMS selector to be used for filtering incoming messages.

      Persistent Delivery

      If true, the Message is sent using the PERSISTENT JMSDeliveryMode

      Priority

      The default JMSPriority value to be used when sending the message

      Time To Live

      Defines the default time the message ise in the broker before it expires and is discarded

      Time To Live Unit

      Time unit to be used in the Time To Live configurations

      Disable Message Id

      If true, the Message is flagged to avoid generating its MessageID

      Disable Message Timestamp

      If true, the Message is flagged to avoid generating its sent Timestamp

      Delivery Delay

      Sets the delivery delay to be applied to postpone the Message delivery

      Delivery Delay Unit

      Time unit to be used in the Delivery Delay configurations.

      Jms Type

      The message type identifier to be set in the JMSType Header when a message is sent.

      SAS (Shared Access Signature) Connection:

      General Blob Storage Connection Connection

      General

      Field

      Description

      Connection Type

      Shared Access Signature

      Blob Storage Connection

      Field

      Description

      Storage Access Key

      Access key from your Storage

      Container Name

      Container’s name

      Storage Account Name

      Account name from storage

      Connection

      Field

      Description

      Service Namespace

      The namespace for the Azure Service Bus Service within your subscription.

      Shared Access Signature

      The unique security token when you set up just one security profile to access all your service resources. In this case when the token has expired, the connector cannot reconnect automatically and you need to stop running the flow to update this configuration setting with a new token.

    • Username and Password Connection

      General Blob Storage Connection Connection

      General

      Field

      Description

      Connection Type

      Username Password

      Blob Storage Connection

      Field

      Description

      Storage Access Key

      Access key from your Storage

      Container Name

      Container’s name

      Storage Account Name

      Account name from storage

      Connection

      Field

      Description

      Shared Access Key Name

      Enter the name of access key configured on the namespace. Any access key created at a lower level (that is, a Topic level Shared Key) does not work with this option, unless you disable the connectivity test at startup.

      Shared Access Key

      Enter the 256-bit primary key.

      Service Namespace

      Enter the name of the service namespace to address Service Bus resources within your application.

    • Windows connection

      General Connection

      General

      Field

      Description

      Connection Type

      Windows

      Connection

      Field

      Description

      Service Namespace

      Enter the name of the service namespace to address Service Bus resources within your application.

      Username

      Enter the user to use for authentication.

      Password

      Enter the password of the user.

      Fully Qualified Domain Name

      Enter the fully qualified domain name of your Windows Service Bus server

      Port

      Enter the server port number.

      Disable SSL Certificate Validation

      If you are using a self-signed SSL certificate, select this check box.

      Skip connectivity test

      In case you have limited access to Windows Service Bus resources and you want to skip the connectivity test performed at startup you need to set this setting to true.

Sources

Queue Receive

  1. Click a trigger and select ServiceBus > Queue Receive

    Queue Source

  2. Fill Global configuration for this connector as we explained in Operations Section

  3. Complete source parameters

    Field Description

    Source Queue

    Queue which is going to receive events

    Disable Auto Acknowledge

    Check this, if you want to Acknowledge events manually with Acknowledge Message operation

    Ack Mode

    The Session ACK mode to use when consuming a message.

    Selector

    Default JMS selector to be used for filtering incoming messages.

    Number Of Consumers

    The number of concurrent consumers to use to receive JMS Messages.

    Body

    The body of the Message.

    JMS Type

    The JMSType identifier header of the Message.

    Correlation ID

    The JMSCorrelationID header of the Message.

    Send Content Type

    Whether or not the body content type should be sent as a property.

    Content Type

    The content type of the Message body.

    Send Encoding

    Whether or not the body outboundEncoding should be sent as a Message property.

    Encoding

    The encoding of the Message body.

    Reply To - Destination

    The destination where a reply to this Message should be sent

    Reply To - Destination Type

    The type of this destination.

    User Properties

    The custom user properties that should be sent to the message

    JMSX Properties

    JMS reserves the 'JMSX' property name prefix for JMS defined properties. Here we define the set of 'well known' properties of JMS.

    Persistent Delivery

    If true, the Message is sent using the PERSISTENT JMSDeliveryMode

    Priority

    The default JMSPriority value to be used when sending the message

    Time To Live

    Defines the default time the message is in the broker before it expires and is discarded

    Time To Live Unit

    Time unit to be used in the Time To Live configurations

    Disable Message Id

    If true, the Message is flagged to avoid generating its MessageID

    Disable Message Timestamp

    If true, the Message is flagged to avoid generating its sent Timestamp

    Delivery Delay

    Sets the delivery delay to be applied in order to postpone the Message delivery

    Delivery Delay Unit

    Time unit to be used in the Delivery Delay configurations.

Topic Receive

  1. Click a trigger and select ServiceBus > Topic Receive

    Queue Source

  2. Fill Global configuration for this connector as we explained in Operations Section

  3. Complete source parameters

    Field Description

    Disable Auto Acknowledge

    Check this, if you want to Acknowledge events manually with Acknowledge Message operation

    Ack Mode

    The Session ACK mode to use when consuming a message.

    Selector

    Default JMS selector to be used for filtering incoming messages.

    Body

    The body of the Message.

    JMS Type

    The JMSType identifier header of the Message.

    Correlation ID

    The JMSCorrelationID header of the Message.

    Send Content Type

    Whether or not the body content type should be sent as a property.

    Content Type

    The content type of the Message body.

    Send Encoding

    Whether or not the body outboundEncoding should be sent as a Message property.

    Encoding

    The encoding of the Message body.

    Reply To - Destination

    The destination where a reply to this Message should be sent

    Reply To - Destination Type

    The type of this destination.

    User Properties

    The custom user properties that should be sent to the message

    JMSX Properties

    JMS reserves the 'JMSX' property name prefix for JMS defined properties. Here we define the set of 'well known' properties of JMS.

    Persistent Delivery

    If true, the Message is sent using the PERSISTENT JMSDeliveryMode

    Priority

    The default JMSPriority value to be used when sending the message

    Time To Live

    Defines the default time the message is in the broker before it expires and is discarded

    Time To Live Unit

    Time unit to be used in the Time To Live configurations

    Disable Message Id

    If true, the Message is flagged to avoid generating its MessageID

    Disable Message Timestamp

    If true, the Message is flagged to avoid generating its sent Timestamp

    Delivery Delay

    Sets the delivery delay to be applied in order to postpone the Message delivery

    Delivery Delay Unit

    Time unit to be used in the Delivery Delay configurations.

    Topic Path

    General Topic that you want to listen to a specific subscription.

    Subscription Path

    Subscription where you are going to receive events.

Connect in Anypoint Studio 7

You can use this connector in Anypoint Studio by adding it as a dependency in your Mule application.

Install Connector in Studio

  1. Open your Mule project in Anypoint Studio.

  2. Add the connector as a dependency in the pom.xml file:

    <dependency>
      <groupId>com.mulesoft.connectors</groupId>
      <artifactId>mule-microsoft-service-bus-connector</artifactId>
      <version>2.0.0</version>
      <classifier>mule-plugin</classifier>
    </dependency>

Configure in Studio

  1. Drag and drop the connector to the Studio Canvas.

  2. Configure the Global element for the connector.

    Configuration values for each Connection type are the same as in the To Connect in Design Center section.

General

Use Case: Get Queue list

General

  1. Create a new Mule Application on your Studio and select an HTTP Listener as a Source in the new flow.

  2. Add a new HTTP Listener Configuration global element:

  3. Specify Host and port parameters with the following values:

    Parameter Value

    Host

    0.0.0.0

    Port

    8081

  4. Click the Save button.

  5. Assign your new Global configuration to your HTTP Listener.

  6. Fill in HTTP Listener path with /servicebus value.

  7. Drag and drop a new Service Bus component on the flow.

  8. Configure the Service Bus connector global element with its environment values.

  9. Add a transform message before the Connector and add an output like this:


         
      
1
2
3
4
%dw 2.0
output application/json
---
payload

+ * Save and run the project as a Mule Application.

+ To test the app, navigate to http://127.0.0.1:8081/servicebus.

XML flow:


         
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:servicebus="http://www.mulesoft.org/schema/mule/servicebus"
        xmlns:http="http://www.mulesoft.org/schema/mule/http"
        xmlns="http://www.mulesoft.org/schema/mule/core"
        xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="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/servicebus
http://www.mulesoft.org/schema/mule/servicebus/current/mule-servicebus.xsd
http://www.mulesoft.org/schema/mule/ee/core
http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
        <configuration-properties file="mule-app.properties" />
        <http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config" >
                <http:listener-connection host="0.0.0.0" port="8081" />
        </http:listener-config>
        <servicebus:config name="Servicebus_Config" doc:name="Servicebus Config" >
                <servicebus:windows-connection
                namespace="${config.namespace}"
                username="${config.username}"
                password="${config.password}"
                fqdn="${config.fqdn}" />
        </servicebus:config>
        <flow name="servicebusFlow">
                <http:listener doc:name="Listener" config-ref="HTTP_Listener_config"
                path="/servicebus"/>
                <servicebus:queues-list doc:name="Queues list" config-ref="Servicebus_Config"/>
                <ee:transform doc:name="Object to JSON">
                        <ee:message >
                                <ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
payload]]></ee:set-payload>
                        </ee:message>
                </ee:transform>
        </flow>
</mule>

Service Bus Authentication

For sending and receiving messages through the Service Bus connector, the authentication is performed through AMQP.

For the REST Management API, the authentication scheme differs based on the Microsoft Service Bus version. The Windows Service Bus running on premises uses OAuth and the Azure Service Bus running on the cloud uses a Shared Access Key token.

The Windows Service Bus uses a self-signed SSL certificate to secure the communication via AMQP and HTTPS. The connector won’t run if this certificate is not locally imported in the box running Mule, unless the Ignore SSL warning check is enabled.

To enable the SSL checks, the certificate must be imported following these steps:

  1. Use the powershell cmdlet Get-SBAutoGeneratedCA to download the certificate locally in the box running the Windows Service Bus. For the purposes of this tutorial, assume the certificate file is exported to %temp%\AutoGeneratedCA.cer.

  2. Go to %programfiles%\Java\jre7. Verify that the bin\keytool.exe tool exists, and that lib\security\cacerts exists. Note that you must be running as Administrator in order to perform a certificate import with Keytool.exe. Otherwise, an Access Denied error is generated.

  3. Enter the following command: bin\keytool.exe –list –keystore lib\security\cacerts

  4. Import the auto-generated Service Bus certificate by running the following command: bin\keytool.exe –importcert –alias AppServerGeneratedSBCA –file %temp%\AutoGeneratedCA.cer –keystore lib\security\cacerts –v

  5. You are prompted for the password (the default is “changeit”). If you do not know the password, you cannot perform the import. When the tool asks you whether to trust the certificate, enter Y (Yes).

SAS Based Authentication

In addition to the connection schemes that require a username and password, the connector provides a connection in which authentication is SAS based (only for Azure) which allows you to set the authentication token for the Service Bus Service without requiring the username and password for it.

As the SAS token schema is URI based (that is, you can assign different authorization access to your resources based on their URIs) the connection supports multiple ways of providing the authentication tokens needed. The most trivial and simple case is when you have a single profile that authorizes accesses to all your resources by using an specific root URI which is the base endpoint that your service expose. If you need to provide different access tokens on different resources, then you can use a setting that allows you to configure a list of them according to the resources the connector will need to access during its running time.

Last but not least, and extending the mechanisms described above to provide the authentication token, there is another mechanism that allows you to implement a custom token provider to allow the connector requests for security tokens when needed. It is your responsibility to solve each request and to return a fresh token every time the connector asks for one. As the token has an expiration time within it, this mechanism allows the connector to re-authenticate with the target resource once the token has expired (this is not allowed with the previous mechanisms described above where the tokens are fixed at configuration time before the flow runs).

The following are the available settings for the Shared Access Signature connection:

Service Namespace: The namespace for the Azure Service Bus Service within your subscription.

Shared Access Signature: (Optional) The unique security token when you set up just one security profile to access all your service resources. In this case after the token expires, the connector cannot reconnect automatically and you need to stop running the flow to update this configuration setting with a new token.

Within the advanced section you can find:

SAS Tokens List: (Optional) The list of security tokens the connector needs to access different URIs when the security profiles for each one of them are different. In this case after any of the tokens expires, the connector cannot reconnect to the URI linked to that token and you need to stop running the flow to update this configuration setting with a new set of tokens.

SAS Tokens Provider: (Optional) An Spring bean reference implementing the org.mule.modules.microsoftservicebus.connection.providers.SharedAccessSignatureProvider interface. If you set an instance of a token provider here, it is your responsibility to provide a fresh token for each URI the connector requires access to (according to your security profiles). In this case each time a token has expired the connector requests for a new one, which is provided by your implementation, and reconnection to the target URI occurs seamlessly.

Max Connections: (Optional) Maximum number of connections to keep in pool in order to be reused by producer. If set to "-1" it creates a new connection everytime.

At least one of the optional settings shown above must be provided.

In all cases, the token format you should provide is a string that must comply with the following pattern:

SharedAccessSignature sr=[resource_uri]&sig=[signature]&se=[ttl]&skn=[profile]

the sr parameter value can start with https or amqps protocol depending on the operation you perform on the target resource.

For example:

SharedAccessSignature sr=amqps%3a%2f%2fmynamespace.servicebus.windows.net%2fMyQueue&sig=pSrfJn5uRTiepgOTjBpjcf2gw%2bG34S1MYdCfkQkTC8A%3d&se=101&skn=OperationalPolicyKey`

Performance Considerations

The Claims Based Security mechanism required to authenticate to Azure Service Bus using a SAS token involves exchanging messages with a special node. The latest impacts on connector’s performance as tokens are exchanged per request in order to achieve connection security setup using targeted tokens (related to the resource being accessed). This has been optimized, starting from version 1.2, to impact performance as low as possible. Anyway, if your scenario requires sending several messages with high throughput it is recommended the connection strategy that requires setting the username and password. This is the simpler way to authenticate to Azure Service Bus with the connector while achieving better throughput, though it requires to write the password for the shared access key name you are using.

As said before, if you are experiencing performance issues when using the SAS strategy we recommend you updating to version 1.2 or higher. The optimized mechanism has lower performance impact on receiving and sending operations as the AMQP container and cache (respectively) keep the connection alive and token exchange messages occur only when setting up the connection and/or in case of token expiration.

Using Restricted Access Policies

In cases where you have restrict access to your resources, having a security policy with permissions just at resource level, the connector cannot perform the connectivity test when it is starting up as this targets the root level of your namespace which might be forbidden due to the customized policy applied to the shared access key. For these scenarios, you need to skip the connectivity test with the configuration option available to this purpose, otherwise connetor’s startup fails.

Use Case: Azure Service Bus AMQP

Studio 7 flows for the Azure Service Bus AMQP demo

XML for this flow:


         
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:servicebus="http://www.mulesoft.org/schema/mule/servicebus"
xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="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/servicebus
http://www.mulesoft.org/schema/mule/servicebus/current/mule-servicebus.xsd
http://www.mulesoft.org/schema/mule/ee/core
http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
        <configuration-properties file="mule-app.properties" doc:name="Configuration properties"/>
        <http:listener-config name="HTTP_Listener_config" doc:name="HTTP Listener config">
                <http:listener-connection host="0.0.0.0" port="8081" />
        </http:listener-config>
        <servicebus:config name="Microsoft_Service_Bus_Config" doc:name="Microsoft Service Bus Config">
                <servicebus:username-password-connection
                        userName="${azure.keyname}"
                        password="${azure.key}"
                        namespace="${azure.namespace}" >
                        <servicebus:caching-strategy >
                                <servicebus:no-caching-configuration />
                        </servicebus:caching-strategy>
                </servicebus:username-password-connection>
        </servicebus:config>
        <flow name="load-http-form-flow">
                <http:listener doc:name="Root Endpoint" config-ref="HTTP_Listener_config"
                        path="/" />
                <parse-template doc:name="Web Form" location="form.html" />
        </flow>
        <flow name="queue-endpoint-flow">
                <http:listener doc:name="Queue Endpoint" config-ref="HTTP_Listener_config"
                        path="/pushMessageQueue" />
                <ee:transform doc:name="Convert Payload to Java Object">
                        <ee:message>
                                <ee:set-payload><![CDATA[%dw 2.0
output application/java
---
payload]]></ee:set-payload>
                        </ee:message>
                </ee:transform>
                <servicebus:queue-send doc:name="Queue send" config-ref="Microsoft_Service_Bus_Config"
                        destinationQueue="#[payload.queue]">
                        <servicebus:message >
                                <servicebus:body ><![CDATA[#[payload.message]]]></servicebus:body>
                        </servicebus:message>
                </servicebus:queue-send>
        </flow>
        <flow name="topic-endpoint-flow">
                <http:listener doc:name="Topic Endpoint" config-ref="HTTP_Listener_config"
                        path="/pushMessageTopic"/>
                <ee:transform doc:name="Convert Payload to Java Object">
                        <ee:message >
                                <ee:set-payload ><![CDATA[%dw 2.0
output application/java
---
payload]]></ee:set-payload>
                        </ee:message>
                </ee:transform>
                <servicebus:topic-send doc:name="Topic send" config-ref="Microsoft_Service_Bus_Config"
                        destinationTopic="#[payload.topic]"
                        transactionalAction="NOT_SUPPORTED"
                        sendCorrelationId="AUTO">
                        <servicebus:message >
                                <servicebus:body ><![CDATA[#[payload.message]]]></servicebus:body>
                        </servicebus:message>
                </servicebus:topic-send>
        </flow>
        <flow name="queue-receive-flow">
                <servicebus:listener
                        sourceType="Queue"
                        destination="${queue.name}"
                        doc:name="Queue receive"
                        config-ref="Microsoft_Service_Bus_Config"
                        ackMode="AUTO" subscription="NONE"
                        numberOfConsumers="1"/>
                <logger level="INFO" doc:name="Log the message" message="#[payload]"/>
        </flow>
        <flow name="topic-receive-flow">
                <servicebus:listener sourceType="Topic" doc:name="Topic receive"
                        config-ref="Microsoft_Service_Bus_Config"
                        ackMode="AUTO" destination="${topic.name}"
                        subscription="${subscription.name}"/>
                <logger level="INFO" doc:name="Log the message" message="#[payload]"/>
        </flow>
</mule>

Use Case: Azure Serice Bus Management

Azure Management Studio 7 Flow

XML flow:


         
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core" xmlns:servicebus="http://www.mulesoft.org/schema/mule/servicebus"
        xmlns:http="http://www.mulesoft.org/schema/mule/http"
        xmlns="http://www.mulesoft.org/schema/mule/core"
        xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="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/servicebus
http://www.mulesoft.org/schema/mule/servicebus/current/mule-servicebus.xsd
http://www.mulesoft.org/schema/mule/ee/core
http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd">
        <configuration-properties file="mule-app.properties"
        doc:name="Configuration properties"/>
        <http:listener-config name="HTTP_Listener_config"
        doc:name="HTTP Listener config">
                <http:listener-connection host="0.0.0.0" port="8081" />
        </http:listener-config>
        <servicebus:config name="Microsoft_Service_Bus_Config"
        doc:name="Microsoft Service Bus Config">
                <servicebus:username-password-connection
                userName="${azure.keyname}"
                password="${azure.key}"
                namespace="${azure.namespace}" >
                        <servicebus:caching-strategy >
                                <servicebus:no-caching-configuration />
                        </servicebus:caching-strategy>
                </servicebus:username-password-connection>
        </servicebus:config>
        <flow name="azure-service-bus-management-demoFlow">
                <http:listener doc:name="Topic Create Endpoint"
                config-ref="HTTP_Listener_config"
                path="/topic"/>
                <ee:transform doc:name="Set ServiceBusTopicDescription">
                        <ee:message >
                                <ee:set-payload ><![CDATA[%dw 2.0
output application/java
---
{
        defaultMessageTimeToLive: "P10675199DT2H48M5.4775807S",
        duplicateDetectionHistoryTimeWindow: "PT10M",
        enableBatchedOperations: false,
        maxSizeInMegabytes: 1024,
        requiresDuplicateDetection: false,
        sizeInBytes: null
} as Object {
        class : "com.mulesoft.connectors.microsoft.servicebus.extension.api.entity.ServiceBusTopicDescription"
}]]></ee:set-payload>
                        </ee:message>
                </ee:transform>
                <servicebus:topic-create doc:name="Topic create"
                config-ref="Microsoft_Service_Bus_Config"
                topicPath="${topic.name}">
                </servicebus:topic-create>
                <ee:transform doc:name="Object to Json">
                        <ee:message >
                                <ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
{
        author: payload.author,
        id: payload.id,
        title: payload.title
}]]></ee:set-payload>
                        </ee:message>
                </ee:transform>
                <logger level="INFO" doc:name="Logger" message="#[payload]"/>
        </flow>
        <flow name="azure-service-bus-management-demoFlow1">
                <http:listener doc:name="Subscription Create Endpoint"
                config-ref="HTTP_Listener_config"
                path="/subscription"/>
                <ee:transform doc:name="Set ServiceBusSubscriptionDescription">
                        <ee:message >
                                <ee:set-payload ><![CDATA[%dw 2.0
output application/java
---
{
        lockDuration: "PT4M",
        requiresSession: false,
        deadLetteringOnMessageExpiration: false,
        deadLetteringOnFilterEvaluationExceptions: null,
        enableBatchedOperations: false,
        defaultMessageTimeToLive: "P10675199DT2H48M5.4775807S",
        maxDeliveryCount: null
} as Object {
        class : "com.mulesoft.connectors.microsoft.servicebus.extension.api.entity.ServiceBusSubscriptionDescription"
}]]></ee:set-payload>
                        </ee:message>
                </ee:transform>
                <servicebus:subscription-create
                topicPath="${topic.name}"
                doc:name="Subscription create"
                config-ref="Microsoft_Service_Bus_Config"
                subscriptionPath="${subscription.name}"/>
                <ee:transform doc:name="Object to Json">
                        <ee:message >
                                <ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
{
        linik: payload.link,
        id: payload.id,
        title: payload.title
}]]></ee:set-payload>
                        </ee:message>
                </ee:transform>
                <logger level="INFO" doc:name="Logger" message="#[payload]"/>
        </flow>
        <flow name="azure-service-bus-management-demoFlow2">
                <http:listener doc:name="Rule Create Endpoint"
                config-ref="HTTP_Listener_config"
                path="/rule"/>
                <ee:transform doc:name="Set ServiceBusRuleDescription">
                        <ee:message >
                                <ee:set-payload ><![CDATA[%dw 2.0
output application/java
---
{
        action: {
                sqlExpression: "set MyProperty2 = 'ABC'",
                "type": "SqlRuleAction"
        },
        filter: {
                correlationId: null,
                sqlExpression: "property1 = 'ok'",
                "type": "SqlFilter"
        }
} as Object {
        class : "com.mulesoft.connectors.microsoft.servicebus.extension.api.entity.ServiceBusRuleDescription"
}]]></ee:set-payload>
                        </ee:message>
                </ee:transform>
                <servicebus:rule-create topicPath="${topic.name}" doc:name="Rule create" config-ref="Microsoft_Service_Bus_Config" rulePath="${rule.name}" subscriptionPath="${subscription.name}"/>
                <ee:transform doc:name="Object to Json">
                        <ee:message >
                                <ee:set-payload ><![CDATA[%dw 2.0
output application/json
---
{
        link: payload.link,
        id: payload.id,
        title: payload.title
}]]></ee:set-payload>
                        </ee:message>
                </ee:transform>
                <logger level="INFO" doc:name="Logger" message="#[payload]"/>
        </flow>
</mule>

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.

+