Skip to content

Commit 61f66ad

Browse files
authored
Update Service Bus emulator configuration and setup
1 parent e29d9ae commit 61f66ad

File tree

1 file changed

+51
-19
lines changed

1 file changed

+51
-19
lines changed

articles/service-bus-messaging/test-locally-with-service-bus-emulator.md

Lines changed: 51 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ To run the Service Bus emulator locally on Linux or macOS:
5959
6060
```JSON
6161
{
62-
"UserConfig": {
62+
"UserConfig": {
6363
"Namespaces": [
6464
{
6565
"Name": "sbemulatorns",
@@ -73,7 +73,7 @@ To run the Service Bus emulator locally on Linux or macOS:
7373
"ForwardDeadLetteredMessagesTo": "",
7474
"ForwardTo": "",
7575
"LockDuration": "PT1M",
76-
"MaxDeliveryCount": 10,
76+
"MaxDeliveryCount": 3,
7777
"RequiresDuplicateDetection": false,
7878
"RequiresSession": false
7979
}
@@ -95,7 +95,7 @@ To run the Service Bus emulator locally on Linux or macOS:
9595
"DeadLetteringOnMessageExpiration": false,
9696
"DefaultMessageTimeToLive": "PT1H",
9797
"LockDuration": "PT1M",
98-
"MaxDeliveryCount": 10,
98+
"MaxDeliveryCount": 3,
9999
"ForwardDeadLetteredMessagesTo": "",
100100
"ForwardTo": "",
101101
"RequiresSession": false
@@ -106,14 +106,15 @@ To run the Service Bus emulator locally on Linux or macOS:
106106
"Properties": {
107107
"FilterType": "Correlation",
108108
"CorrelationFilter": {
109-
"ContentType": "application/text",
110-
"CorrelationId": "id1",
111-
"Label": "subject1",
112-
"MessageId": "msgid1",
113-
"ReplyTo": "someQueue",
114-
"ReplyToSessionId": "sessionId",
115-
"SessionId": "session1",
116-
"To": "xyz"
109+
"ContentType": "application/json"
110+
// Other supported properties
111+
// "CorrelationId": "id1",
112+
// "Label": "subject1",
113+
// "MessageId": "msgid1",
114+
// "ReplyTo": "someQueue",
115+
// "ReplyToSessionId": "sessionId",
116+
// "SessionId": "session1",
117+
// "To": "xyz"
117118
}
118119
}
119120
}
@@ -125,7 +126,7 @@ To run the Service Bus emulator locally on Linux or macOS:
125126
"DeadLetteringOnMessageExpiration": false,
126127
"DefaultMessageTimeToLive": "PT1H",
127128
"LockDuration": "PT1M",
128-
"MaxDeliveryCount": 10,
129+
"MaxDeliveryCount": 3,
129130
"ForwardDeadLetteredMessagesTo": "",
130131
"ForwardTo": "",
131132
"RequiresSession": false
@@ -137,7 +138,7 @@ To run the Service Bus emulator locally on Linux or macOS:
137138
"FilterType": "Correlation",
138139
"CorrelationFilter": {
139140
"Properties": {
140-
"prop3": "value3"
141+
"prop1": "value1"
141142
}
142143
}
143144
}
@@ -150,11 +151,37 @@ To run the Service Bus emulator locally on Linux or macOS:
150151
"DeadLetteringOnMessageExpiration": false,
151152
"DefaultMessageTimeToLive": "PT1H",
152153
"LockDuration": "PT1M",
153-
"MaxDeliveryCount": 10,
154+
"MaxDeliveryCount": 3,
154155
"ForwardDeadLetteredMessagesTo": "",
155156
"ForwardTo": "",
156157
"RequiresSession": false
157158
}
159+
},
160+
{
161+
"Name": "subscription.4",
162+
"Properties": {
163+
"DeadLetteringOnMessageExpiration": false,
164+
"DefaultMessageTimeToLive": "PT1H",
165+
"LockDuration": "PT1M",
166+
"MaxDeliveryCount": 3,
167+
"ForwardDeadLetteredMessagesTo": "",
168+
"ForwardTo": "",
169+
"RequiresSession": false
170+
},
171+
"Rules": [
172+
{
173+
"Name": "sql-filter-1",
174+
"Properties": {
175+
"FilterType": "Sql",
176+
"SqlFilter": {
177+
"SqlExpression": "sys.MessageId = '123456' AND userProp1 = 'value1'"
178+
},
179+
"Action" : {
180+
"SqlExpression": "SET sys.To = 'Entity'"
181+
}
182+
}
183+
}
184+
]
158185
}
159186
]
160187
}
@@ -164,8 +191,8 @@ To run the Service Bus emulator locally on Linux or macOS:
164191
"Logging": {
165192
"Type": "File"
166193
}
167-
}
168-
}
194+
}
195+
}
169196
170197
```
171198

@@ -180,14 +207,17 @@ services:
180207
emulator:
181208
container_name: "servicebus-emulator"
182209
image: mcr.microsoft.com/azure-messaging/servicebus-emulator:latest
210+
pull_policy: always
183211
volumes:
184212
- "${CONFIG_PATH}:/ServiceBus_Emulator/ConfigFiles/Config.json"
185213
ports:
186214
- "5672:5672"
215+
- "5300:5300"
187216
environment:
188-
SQL_SERVER: sqledge
189-
MSSQL_SA_PASSWORD: ${MSSQL_SA_PASSWORD}
217+
SQL_SERVER: sqledge
218+
MSSQL_SA_PASSWORD: "${SQL_PASSWORD}" # Password should be same as what is set for SQL Edge
190219
ACCEPT_EULA: ${ACCEPT_EULA}
220+
SQL_WAIT_INTERVAL: ${SQL_WAIT_INTERVAL} # Optional: Time in seconds to wait for SQL to be ready (default is 15 seconds)
191221
depends_on:
192222
- sqledge
193223
networks:
@@ -203,9 +233,11 @@ services:
203233
- "sqledge"
204234
environment:
205235
ACCEPT_EULA: ${ACCEPT_EULA}
206-
MSSQL_SA_PASSWORD: ${MSSQL_SA_PASSWORD}
236+
MSSQL_SA_PASSWORD: "${SQL_PASSWORD}" # To be filled by user as per policy : https://learn.microsoft.com/en-us/sql/relational-databases/security/strong-passwords?view=sql-server-linux-ver16
237+
207238
networks:
208239
sb-emulator:
240+
209241
```
210242

211243
3. Create .env file to declare the environment variables for Service Bus emulator and ensure all of the following environment variables are set.

0 commit comments

Comments
 (0)