Skip to content
Merged
31 changes: 31 additions & 0 deletions 101-integrationpatterns-messagerouter-servicebus/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Integration Patterns - Message Router - Service Bus

<a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F101-integrationpatterns-messagerouter-servicebus%2Fazuredeploy.json" target="_blank">
<img src="https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/deploytoazure.png"/>
</a>
<a href="http://armviz.io/#/?load=https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2F101-integrationpatterns-messagerouter-servicebus%2Fazuredeploy.json" target="_blank">
<img src="https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/1-CONTRIBUTION-GUIDE/images/visualizebutton.png"/>
</a>

## Solution overview and deployed resources

This template deploys a solution which shows how we can set up the <a href="http://www.enterpriseintegrationpatterns.com/patterns/messaging/MessageRouter.html" target="_blank">Message Router pattern</a> using a Service Bus Topic. The topic expects a message with a property called *Priority*. The message is then routed to the *Log* subscription as well as the subscription belonging with the given priority.

The following resources are deployed as part of the solution.

+ **Service Bus Namespace**
+ **Service Bus Topic**
+ **Service Bus Topic Subscriptions**
+ **Service Bus Topic Subscriptions Rules**

To test, grab the connection string of the Service Bus namespace, and use a tool like Service Bus Explorer to send a message to the topic. The message to be sent in should be in the following format, and with a property called *Priority*, with value *High*, *Normal* or *Low*.

```json
{
"Address":"Wilhelminakade 175",
"City":"Rotterdam",
"Name":"Eldert Grootenboer"
}
```

`Tags: Service Bus, Integration Patterns, Service Bus Topics, Message Router, ServiceBus, IntegrationPatterns`
197 changes: 197 additions & 0 deletions 101-integrationpatterns-messagerouter-servicebus/azuredeploy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"IncomingDeliveryRequestsTopicName": {
"defaultValue": "incomingdeliveryrequests",
"metadata": {
"description": "The name for the Service Bus Topic."
},
"type": "string"
},
"MessageRouterServiceBusNamespacePrefix": {
"defaultValue": "MessageRouterServiceBus",
"metadata": {
"description": "The prefix of the name for the Service Bus namespace, will be appended with a unique string."
},
"type": "string"
}
},
"variables": {
"serviceBusNamespaceName": "[concat(parameters('MessageRouterServiceBusNamespacePrefix'), '-', uniquestring(resourceGroup().id))]"
},
"resources": [
{
"apiVersion": "2015-08-01",
"dependsOn": [],
"kind": "Messaging",
"location": "[resourceGroup().location]",
"name": "[variables('serviceBusNamespaceName')]",
"sku": {
"capacity": 1,
"name": "Standard",
"tier": "Standard"
},
"type": "Microsoft.ServiceBus/namespaces"
},
{
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces', variables('serviceBusNamespaceName'))]"
],
"location": "[resourceGroup().location]",
"name": "[concat(variables('serviceBusNamespaceName'), '/', parameters('IncomingDeliveryRequestsTopicName'))]",
"properties": {
"defaultMessageTimeToLive": "14.00:00:00",
"enableBatchedOperations": false,
"enableExpress": false,
"enablePartitioning": true,
"enableSubscriptionPartitioning": false,
"filteringMessagesBeforePublishing": false,
"isAnonymousAccessible": false,
"isExpress": false,
"maxSizeInMegabytes": 1024,
"requiresDuplicateDetection": false,
"sizeInBytes": 0,
"supportOrdering": false
},
"type": "Microsoft.ServiceBus/namespaces/topics"
},
{
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces', variables('serviceBusNamespaceName'))]",
"[resourceId('Microsoft.ServiceBus/namespaces/topics', variables('serviceBusNamespaceName'), parameters('IncomingDeliveryRequestsTopicName'))]"
],
"location": "[resourceGroup().location]",
"name": "[concat(variables('serviceBusNamespaceName'), '/', parameters('IncomingDeliveryRequestsTopicName'), '/HighPriority')]",
"properties": {
"deadLetteringOnFilterEvaluationExceptions": false,
"deadLetteringOnMessageExpiration": true,
"defaultMessageTimeToLive": "14.00:00:00",
"enableBatchedOperations": false,
"lockDuration": "00:00:30",
"maxDeliveryCount": 10,
"requiresSession": false
},
"resources": [
{
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces/topics/subscriptions', variables('serviceBusNamespaceName'), parameters('IncomingDeliveryRequestsTopicName'), 'HighPriority')]"
],
"name": "HighPriority",
"properties": {
"filter": {
"sqlExpression": "Priority='High'"
}
},
"type": "Rules"
}
],
"type": "Microsoft.ServiceBus/namespaces/topics/subscriptions"
},
{
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces', variables('serviceBusNamespaceName'))]",
"[resourceId('Microsoft.ServiceBus/namespaces/topics', variables('serviceBusNamespaceName'), parameters('IncomingDeliveryRequestsTopicName'))]"
],
"location": "[resourceGroup().location]",
"name": "[concat(variables('serviceBusNamespaceName'), '/', parameters('IncomingDeliveryRequestsTopicName'), '/Log')]",
"properties": {
"deadLetteringOnFilterEvaluationExceptions": false,
"deadLetteringOnMessageExpiration": true,
"defaultMessageTimeToLive": "14.00:00:00",
"enableBatchedOperations": false,
"lockDuration": "00:00:30",
"maxDeliveryCount": 10,
"requiresSession": false
},
"resources": [
{
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces/topics/subscriptions', variables('serviceBusNamespaceName'), parameters('IncomingDeliveryRequestsTopicName'), 'Log')]"
],
"name": "LogAll",
"properties": {
"filter": {
"sqlExpression": "1=1"
}
},
"type": "Rules"
}
],
"type": "Microsoft.ServiceBus/namespaces/topics/subscriptions"
},
{
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces', variables('serviceBusNamespaceName'))]",
"[resourceId('Microsoft.ServiceBus/namespaces/topics', variables('serviceBusNamespaceName'), parameters('IncomingDeliveryRequestsTopicName'))]"
],
"location": "[resourceGroup().location]",
"name": "[concat(variables('serviceBusNamespaceName'), '/', parameters('IncomingDeliveryRequestsTopicName'), '/LowPriority')]",
"properties": {
"deadLetteringOnFilterEvaluationExceptions": false,
"deadLetteringOnMessageExpiration": true,
"defaultMessageTimeToLive": "14.00:00:00",
"enableBatchedOperations": false,
"lockDuration": "00:00:30",
"maxDeliveryCount": 10,
"requiresSession": false
},
"resources": [
{
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces/topics/subscriptions', variables('serviceBusNamespaceName'), parameters('IncomingDeliveryRequestsTopicName'), 'LowPriority')]"
],
"name": "LowPriority",
"properties": {
"filter": {
"sqlExpression": "Priority='Low'"
}
},
"type": "Rules"
}
],
"type": "Microsoft.ServiceBus/namespaces/topics/subscriptions"
},
{
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces', variables('serviceBusNamespaceName'))]",
"[resourceId('Microsoft.ServiceBus/namespaces/topics', variables('serviceBusNamespaceName'), parameters('IncomingDeliveryRequestsTopicName'))]"
],
"location": "[resourceGroup().location]",
"name": "[concat(variables('serviceBusNamespaceName'), '/', parameters('IncomingDeliveryRequestsTopicName'), '/NormalPriority')]",
"properties": {
"deadLetteringOnFilterEvaluationExceptions": false,
"deadLetteringOnMessageExpiration": true,
"defaultMessageTimeToLive": "14.00:00:00",
"enableBatchedOperations": false,
"lockDuration": "00:00:30",
"maxDeliveryCount": 10,
"requiresSession": false
},
"resources": [
{
"apiVersion": "2015-08-01",
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces/topics/subscriptions', variables('serviceBusNamespaceName'), parameters('IncomingDeliveryRequestsTopicName'), 'NormalPriority')]"
],
"name": "NormalPriority",
"properties": {
"filter": {
"sqlExpression": "Priority='Normal'"
}
},
"type": "Rules"
}
],
"type": "Microsoft.ServiceBus/namespaces/topics/subscriptions"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"itemDisplayName": "Integration Patterns - Message Router - Service Bus",
"description": "Solution which shows how we can set up the Message Router pattern using a Service Bus Topic",
"summary": "Solution which shows how we can set up the Message Router pattern using a Service Bus Topic",
"githubUsername": "Eldert Grootenboer",
"dateUpdated": "2017-09-06"
}