{"id":329,"date":"2026-11-22T12:00:00","date_gmt":"2026-11-22T12:00:00","guid":{"rendered":"https:\/\/rezachegini.com\/?p=329"},"modified":"2026-11-22T19:16:19","modified_gmt":"2026-11-22T19:16:19","slug":"building-a-job-board-api-part-24-azure-service-bus-running-locally","status":"publish","type":"post","link":"https:\/\/rezachegini.com\/?p=329","title":{"rendered":"Building a Job Board API, Part 24: Azure Service Bus, Running Locally"},"content":{"rendered":"<p>I&#8217;m sharing one of my projects here from the beginning, step by step. It&#8217;s a Job Board API built with Django, Django REST Framework, PostgreSQL and Docker Compose, with S3 and SQS (through LocalStack), Redis, and a background worker.<\/p>\n<p>I&#8217;m a junior engineer looking for my first role in DevOps, SRE or Cloud. That&#8217;s why I build projects like this and write about them in public. It shows how I think, and writing it down helps me really understand it.<\/p>\n<p>In Part 23, one setting, CLOUD_PROVIDER, started switching the storage between S3 and Azure Blob Storage. But the queue was still SQS on both clouds. Moving the queue to Azure turned into three articles:<\/p>\n<ol class=\"wp-block-list\">\n<li>This one: running Azure Service Bus locally, and learning how it really behaves.<\/li>\n<li>Part 25: a second queue class behind the same interface, and a health check that could hang forever.<\/li>\n<li>Part 26: the real API and worker end to end, which found a 12-second wait and 4 copies of one message.<\/li>\n<\/ol>\n<p>In this part, Microsoft&#8217;s Service Bus emulator runs in Docker Compose, with SQL Server 2022 as its storage. The queue job-board-status gets the same behaviour as my SQS queue: a 30-second lock, and 3 deliveries before a message goes to the dead-letter queue. No app code changes yet. This part is about understanding the broker before writing code for it.<\/p>\n<h3 class=\"wp-block-heading\">The SDK<\/h3>\n<pre class=\"wp-block-code\"><code>uv add \"azure-servicebus&gt;=7.12\"<\/code><\/pre>\n<p>This is the official Python SDK for Service Bus. One big difference from SQS already: it speaks AMQP (port 5672), not HTTP like boto3. AMQP keeps one long-lived connection open, instead of one HTTP request per call. That difference shows up again and again in the next two articles.<\/p>\n<p>It&#8217;s a runtime dependency, because the API (publishing) and the worker (receiving) will both use it. So I rebuilt all three images.<\/p>\n<h3 class=\"wp-block-heading\">Finding the image tags with a script<\/h3>\n<p>I never use latest for images, because it can change under me. To find the newest real version of the emulator, I asked Microsoft&#8217;s registry directly:<\/p>\n<pre class=\"wp-block-code\"><code>SB_TAG=$(curl -s https:\/\/mcr.microsoft.com\/v2\/azure-messaging\/servicebus-emulator\/tags\/list | python3 -c \"import sys, json, re; t = [x for x in json.load(sys.stdin)['tags'] if re.fullmatch(r'\\d+\\.\\d+\\.\\d+', x)]; print(max(t, key=lambda v: tuple(map(int, v.split('.')))) if t else '')\")<\/code><\/pre>\n<ul class=\"wp-block-list\">\n<li>\/v2\/&lt;repo&gt;\/tags\/list is the standard Docker Registry v2 API. Microsoft&#8217;s registry answers with JSON: {&#8220;name&#8221;: &#8230;, &#8220;tags&#8221;: [&#8230;]}.<\/li>\n<li>re.fullmatch(r&#8217;\\d+\\.\\d+\\.\\d+&#8217;, x) keeps only plain version tags like 2.0.1, and drops latest.<\/li>\n<li>max(&#8230;, key=lambda v: tuple(map(int, v.split(&#8216;.&#8217;)))) compares versions as numbers. This matters: as text, &#8220;1.9.0&#8221; is bigger than &#8220;1.10.0&#8221;, which is wrong. As numbers, (1, 10, 0) &gt; (1, 9, 0).<\/li>\n<li>if t else &#8221; prints an empty string instead of crashing when nothing matches.<\/li>\n<\/ul>\n<p>The same idea found the newest SQL Server 2022 patch. Its tags look like 2022-CU27-ubuntu-22.04, where CU is the cumulative update (the patch level), so I picked the highest CU number. Then a guarded sed wrote both tags into docker-compose.yml:<\/p>\n<pre class=\"wp-block-code\"><code>[ -n \"$SB_TAG\" ] &amp;&amp; [ -n \"$SQL_TAG\" ] \\\n  &amp;&amp; sed -i \"s|servicebus-emulator:&lt;SB_TAG&gt;|servicebus-emulator:$SB_TAG|; s|mssql\/server:&lt;SQL_TAG&gt;|mssql\/server:$SQL_TAG|\" docker-compose.yml \\\n  || echo \"STOP: a tag lookup came back empty\"<\/code><\/pre>\n<ul class=\"wp-block-list\">\n<li>[ -n &#8220;$VAR&#8221; ] is true when the variable isn&#8217;t empty. Without this guard, an empty lookup would write servicebus-emulator: with no tag. The | is the sed delimiter because the image names contain \/.<\/li>\n<\/ul>\n<p>The result: emulator 2.0.1 and SQL Server 2022-CU27-ubuntu-22.04.<\/p>\n<h3 class=\"wp-block-heading\">Config.json: defining the queue<\/h3>\n<p>The emulator reads servicebus\/Config.json once, at startup. It&#8217;s the only way to create queues on the emulator. On real Azure, Terraform will create them instead.<\/p>\n<pre class=\"wp-block-code\"><code>{\n  \"UserConfig\": {\n    \"Namespaces\": [\n      {\n        \"Name\": \"sbemulatorns\",\n        \"Queues\": [\n          {\n            \"Name\": \"job-board-status\",\n            \"Properties\": {\n              \"DeadLetteringOnMessageExpiration\": false,\n              \"DefaultMessageTimeToLive\": \"PT1H\",\n              \"DuplicateDetectionHistoryTimeWindow\": \"PT20S\",\n              \"ForwardDeadLetteredMessagesTo\": \"\",\n              \"ForwardTo\": \"\",\n              \"LockDuration\": \"PT30S\",\n              \"MaxDeliveryCount\": 3,\n              \"RequiresDuplicateDetection\": false,\n              \"RequiresSession\": false\n            }\n          }\n        ],\n        \"Topics\": []\n      }\n    ],\n    \"Logging\": {\n      \"Type\": \"File\"\n    }\n  }\n}<\/code><\/pre>\n<ul class=\"wp-block-list\">\n<li>A namespace is the container for queues and topics, a bit like an AWS account plus region for SQS. On real Azure, it&#8217;s also the DNS name: &lt;namespace&gt;.servicebus.windows.net.<\/li>\n<li>The same queue name as SQS, job-board-status.<\/li>\n<li>There&#8217;s no dead-letter queue to define. Every Service Bus queue has a built-in dead-letter subqueue, job-board-status\/$DeadLetterQueue. On SQS, I had to create a second queue and link it with a redrive policy.<\/li>\n<li>Durations are ISO 8601: PT1H is one hour, PT30S is 30 seconds.<\/li>\n<li>LockDuration: PT30S matches SQS&#8217;s VisibilityTimeout: 30. After a receive, the message is locked for 30 seconds. If the worker doesn&#8217;t settle it in time, the lock expires and the message is delivered again.<\/li>\n<li>MaxDeliveryCount: 3 matches SQS&#8217;s maxReceiveCount: 3. On the 3rd failed delivery, Service Bus moves the message to the dead-letter subqueue by itself. The Azure default is 10, so I set it on purpose.<\/li>\n<li>DefaultMessageTimeToLive: PT1H: a message nobody receives in an hour expires. DeadLetteringOnMessageExpiration: false drops it instead of dead-lettering it, because the DLQ is for messages that failed.<\/li>\n<li>RequiresDuplicateDetection: false, because my worker is already idempotent. This decision didn&#8217;t survive Part 26. Real evidence changed it, and I&#8217;ll tell that story there.<\/li>\n<li>RequiresSession: false: sessions give ordered processing. Status emails don&#8217;t need ordering, just as I used a standard SQS queue, not FIFO.<\/li>\n<li>Topics: []: a topic is like SNS, one message to many subscribers. I have one consumer, so a queue is enough.<\/li>\n<\/ul>\n<p>Before starting anything, I checked the file was valid JSON: python3 -m json.tool servicebus\/Config.json &gt; \/dev\/null. A missing comma would make the emulator fail at startup with a much less clear message.<\/p>\n<h3 class=\"wp-block-heading\">A separate secrets file for SQL Server<\/h3>\n<p>The emulator stores its data in SQL Server, and SQL Server needs an admin password. I created it in a separate file:<\/p>\n<pre class=\"wp-block-code\"><code>printf 'ACCEPT_EULA=Y\\nMSSQL_SA_PASSWORD=%s\\n' \"Sb1-$(python3 -c 'import secrets; print(secrets.token_urlsafe(24))')\" &gt; .env.servicebus\nchmod 600 .env.servicebus<\/code><\/pre>\n<ul class=\"wp-block-list\">\n<li>ACCEPT_EULA=Y: both images refuse to start without it. Setting it means I accept the license terms for the emulator and for SQL Server Developer edition, which is for development and test only.<\/li>\n<li>SQL Server&#8217;s password policy needs at least 8 characters from three of four groups: upper, lower, digits and symbols. The Sb1- prefix guarantees all four, and token_urlsafe(24) adds 32 random characters from a safe alphabet. No $ for Compose to expand, and no &amp; for sed: the lesson from Part 16.<\/li>\n<li>printf &#8216;&#8230;%s&#8230;&#8217; inserts the value without the shell treating any character specially.<\/li>\n<li>The value is never printed. I check the file by name only: cut -d= -f1 .env.servicebus.<\/li>\n<\/ul>\n<p>A tracked template, .env.servicebus.example, shows the names, with ACCEPT_EULA=N. Anyone who clones the repo has to make their own license decision, and the containers won&#8217;t start until they do. A !.env.servicebus.example line in .gitignore makes an exception to the .env.* rule, the same pattern as the LocalStack token in Part 16.<\/p>\n<h3 class=\"wp-block-heading\">Two new Compose services<\/h3>\n<pre class=\"wp-block-code\"><code>servicebus-sql:\n    image: mcr.microsoft.com\/mssql\/server:2022-CU27-ubuntu-22.04\n    profiles: [\"azure\"]\n    env_file: .env.servicebus\n    environment:\n      MSSQL_MEMORY_LIMIT_MB: \"2048\"\n\nservicebus:\n    image: mcr.microsoft.com\/azure-messaging\/servicebus-emulator:2.0.1\n    profiles: [\"azure\"]\n    env_file: .env.servicebus\n    environment:\n      SQL_SERVER: servicebus-sql\n    volumes:\n      - .\/servicebus\/Config.json:\/ServiceBus_Emulator\/ConfigFiles\/Config.json:ro\n    depends_on:\n      - servicebus-sql\n    restart: unless-stopped<\/code><\/pre>\n<ul class=\"wp-block-list\">\n<li>SQL Server for Linux, not Azure SQL Edge. Older samples use SQL Edge, which Microsoft has retired. Microsoft&#8217;s current docs pair the emulator with SQL Server Linux.<\/li>\n<li>profiles: [&#8220;azure&#8221;]: both services exist in the file but are off by default. docker compose up -d ignores them, and docker compose &#8211;profile azure up -d starts them. Together they use about 0.9 GB of memory, which my everyday AWS work doesn&#8217;t need.<\/li>\n<li>env_file: .env.servicebus: only these two containers get the SQL password. The api and worker read .env, so they never see it. Least privilege, as in Part 16.<\/li>\n<li>MSSQL_MEMORY_LIMIT_MB: &#8220;2048&#8221;: without a limit, SQL Server sizes its cache from the host&#8217;s memory. thor has 14.86 GiB.<\/li>\n<li>SQL_SERVER: servicebus-sql tells the emulator where its database is, by Compose service name.<\/li>\n<li>The Config.json mount must be at exactly this path, or the emulator starts with no queue, and every send fails with &#8220;entity not found&#8221;. :ro makes it read-only.<\/li>\n<li>depends_on only orders the start. SQL Server&#8217;s container starts first, but Compose doesn&#8217;t wait for SQL Server to accept connections. The SQL image has no healthcheck to wait on. restart: unless-stopped covers that gap: if the emulator gives up because SQL Server isn&#8217;t ready, Docker starts it again.<\/li>\n<li>No ports: on either service. They&#8217;re reachable only on the Compose network, so nothing is open on thor&#8217;s LAN address.<\/li>\n<li>No volumes for data. On every start, the queue is recreated empty from Config.json. That&#8217;s fine for a dev emulator, but it surprised me later, in Part 26.<\/li>\n<\/ul>\n<h3 class=\"wp-block-heading\">Checking the broker before writing any code<\/h3>\n<p>There are no pytest tests in this part. These checks are the tests.<\/p>\n<h3 class=\"wp-block-heading\">Check 1: is it ready, and did it read my config?<\/h3>\n<p>Both containers showed Up. But Up only means the processes started. The emulator&#8217;s log is the real evidence:<\/p>\n<pre class=\"wp-block-code\"><code>Entity Sync complete; Operation Result:True\nUser defined entities created for SB Emulator\nEmulator Service is Successfully Up!<\/code><\/pre>\n<p>&#8220;User defined entities created&#8221; is the line that matters. &#8220;Successfully Up&#8221; alone could also appear with a missing config.<\/p>\n<h3 class=\"wp-block-heading\">Check 2: the health endpoint, from the app&#8217;s network<\/h3>\n<p>From inside the api container, GET http:\/\/servicebus:5300\/health returned 200 {&#8220;status&#8221;:&#8221;healthy&#8221;,&#8221;message&#8221;:&#8221;Service is healthy.&#8221;}. I ran it from the api container on purpose: the port isn&#8217;t published on thor, and this proves the network path the app will use, from the Compose DNS name to the emulator.<\/p>\n<h3 class=\"wp-block-heading\">Check 3: send, receive, complete<\/h3>\n<pre class=\"wp-block-code\"><code>CS = \"Endpoint=sb:\/\/servicebus;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=SAS_KEY_VALUE;UseDevelopmentEmulator=true;\"\nwith ServiceBusClient.from_connection_string(CS) as client:\n    with client.get_queue_sender(\"job-board-status\") as sender:\n        sender.send_messages(ServiceBusMessage('{\"hello\": \"service bus\"}'))\n    with client.get_queue_receiver(\"job-board-status\", max_wait_time=5) as receiver:\n        [message] = receiver.receive_messages(max_message_count=1, max_wait_time=5)\n        print(\"received:\", str(message), \"delivery_count:\", message.delivery_count)\n        receiver.complete_message(message)<\/code><\/pre>\n<ul class=\"wp-block-list\">\n<li>sb:\/\/servicebus is the sb:\/\/ scheme plus the Compose service name. The emulator&#8217;s own log prints localhost, but inside the api container, localhost is the api container itself.<\/li>\n<li>SAS_KEY_VALUE is the emulator&#8217;s fixed, published development key. Not a secret, like Azurite&#8217;s key and LocalStack&#8217;s test\/test.<\/li>\n<li>UseDevelopmentEmulator=true lets the SDK connect without TLS, which only the emulator allows. Real Azure uses AMQP over TLS on port 5671.<\/li>\n<li>with &#8230; as client holds an AMQP connection open and closes it cleanly at the end.<\/li>\n<li>A sender and a receiver are links for one queue on that connection.<\/li>\n<\/ul>\n<p>The default receive mode is peek-lock: the message is locked, not removed. Then complete_message removes it, like SQS&#8217;s delete_message. But there&#8217;s one important difference: it must be called on the same receiver that received the message, while the lock is held. SQS can delete with any client, using the receipt handle. My worker receives and deletes in two separate calls, so this matters a lot in Part 25.<\/p>\n<p>The result: received: {&#8220;hello&#8221;: &#8220;service bus&#8221;} delivery_count: 0, and a second receiver found 0 messages left.<\/p>\n<h3 class=\"wp-block-heading\">Check 4: three failures, then the dead-letter queue<\/h3>\n<pre class=\"wp-block-code\"><code>for attempt in range(1, 4):\n            [message] = receiver.receive_messages(max_message_count=1, max_wait_time=5)\n            print(\"attempt\", attempt, \"delivery_count\", message.delivery_count)\n            receiver.abandon_message(message)<\/code><\/pre>\n<p>abandon_message means &#8220;I failed, give it back now&#8221;. It releases the lock immediately, so 3 deliveries took seconds, not 90. SQS has nothing quite like it; there, I waited for the visibility timeout.<\/p>\n<p>Then I opened the built-in dead-letter queue with sub_queue=ServiceBusSubQueue.DEAD_LETTER:<\/p>\n<pre class=\"wp-block-code\"><code>attempt 1 delivery_count 0\nattempt 2 delivery_count 1\nattempt 3 delivery_count 2\nleft in main queue: 0\ndead-lettered: ['{\"poison\": true}'] ['MaxDeliveryCountExceeded']<\/code><\/pre>\n<p>This is my MaxDeliveryCount: 3 from Config.json working, not a default. And Service Bus records why a message was dead-lettered, in dead_letter_reason. SQS doesn&#8217;t.<\/p>\n<p>One surprise: delivery_count started at 0, then 1, then 2. On SQS, ApproximateReceiveCount is 1 on the first receive. So I must not copy SQS logic like receive_count &gt;= 3 as it is. On Service Bus, the broker counts and dead-letters by itself.<\/p>\n<p>Here are all the ways one delivery can end:<\/p>\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"744\" height=\"276\" src=\"http:\/\/rezachegini.com\/wp-content\/uploads\/2026\/11\/job-board-api-part-24-diagram.png\" alt=\"Diagram: a received message is locked, not removed, until it is settled. Complete removes it, abandon sends it back at once, no settle sends it back after 30 s, and the 3rd failed delivery moves it to the dead-letter queue with reason MaxDeliveryCountExceeded.\" class=\"wp-image-328\" srcset=\"https:\/\/rezachegini.com\/wp-content\/uploads\/2026\/11\/job-board-api-part-24-diagram.png 744w, https:\/\/rezachegini.com\/wp-content\/uploads\/2026\/11\/job-board-api-part-24-diagram-300x111.png 300w\" sizes=\"auto, (max-width: 744px) 100vw, 744px\" \/><\/figure>\n<h3 class=\"wp-block-heading\">Check 4b: a silent first run<\/h3>\n<p>The first time I pasted check 4, it printed nothing at all. The second run printed the result above. I still don&#8217;t know why. So before moving on, I looked into both queues with peek_messages, which reads messages without locking or removing them, and without raising their delivery count. The result: main 0, dead-letter 0. Whatever happened in that silent run, nothing was left behind for the next part.<\/p>\n<h3 class=\"wp-block-heading\">Check 5: memory<\/h3>\n<p>Right after startup, docker stats &#8211;no-stream showed the emulator at 130.8 MiB and SQL Server at 734 MiB: about 0.9 GB for the pair. That&#8217;s why they live behind a profile, and I stop them when I&#8217;m not working on Azure.<\/p>\n<h3 class=\"wp-block-heading\">SQS vs Service Bus: what I learned before writing code<\/h3>\n<ul class=\"wp-block-list\">\n<li>The dead-letter queue. SQS: a second queue plus a redrive policy. Service Bus: built in, as a subqueue.<\/li>\n<li>The lock. SQS VisibilityTimeout: 30 is Service Bus LockDuration: PT30S.<\/li>\n<li>The retry limit. SQS maxReceiveCount: 3 is Service Bus MaxDeliveryCount: 3.<\/li>\n<li>The delivery count. SQS starts at 1. The emulator starts at 0.<\/li>\n<li>Finishing a message. SQS delete_message works from any client with the receipt handle. Service Bus complete_message must run on the receiver that holds the lock.<\/li>\n<li>Giving a message back. SQS: wait for the visibility timeout. Service Bus: abandon_message, at once.<\/li>\n<li>Why it was dead-lettered. SQS doesn&#8217;t say. Service Bus stores a reason.<\/li>\n<li>The local setup. LocalStack is one container. The Service Bus emulator needs a second container, SQL Server, and about 0.9 GB together.<\/li>\n<li>The protocol. SQS is HTTPS, one request per call. Service Bus is AMQP, a long-lived connection.<\/li>\n<\/ul>\n<p>Two of these will shape the code in Part 25:<\/p>\n<ol class=\"wp-block-list\">\n<li>Settling is tied to the receiver. My worker calls queue.receive() and later queue.delete(message), as two separate calls. On Service Bus, delete must reach the same receiver that received the message, so the queue class has to keep its receiver open between the two calls.<\/li>\n<li>The connection has state. It can break, and it has to be reset. And a health check must not leave connections hanging open.<\/li>\n<\/ol>\n<h3 class=\"wp-block-heading\">Problems I hit<\/h3>\n<h3 class=\"wp-block-heading\">1. invalid reference format<\/h3>\n<pre class=\"wp-block-code\"><code>unable to get image 'mcr.microsoft.com\/azure-messaging\/servicebus-emulator:&lt;SB_TAG&gt;': invalid reference format<\/code><\/pre>\n<p>The Compose snippet I was given had placeholders, &lt;SB_TAG&gt; and &lt;SQL_TAG&gt;, for the tags to look up. They went into the file exactly as written, and &lt; and &gt; aren&#8217;t valid in an image name. It&#8217;s the same mistake as &lt;version-from-above&gt; in Part 23.<\/p>\n<p>The fix was the tag script above: it fills the values in, and it refuses to change anything if a lookup comes back empty. Then grep &#8216;&lt;[A-Z_]*_TAG&gt;&#8217; confirmed no placeholders were left.<\/p>\n<p>The real lesson: placeholders in text that gets pasted as-is will fail every time. A command that fills them in is safer than instructions to fill them in by hand.<\/p>\n<h3 class=\"wp-block-heading\">2. Output pasted back as commands<\/h3>\n<p>The shell printed image:: command not found and no: command not found. I had pasted the output of the previous command back into the shell as if it were commands. Harmless: nothing ran, and no file changed. But it&#8217;s a good reminder to read what&#8217;s on the clipboard before pressing Enter.<\/p>\n<h3 class=\"wp-block-heading\">3. The silent first run<\/h3>\n<p>Check 4&#8217;s first run printed nothing, and I still don&#8217;t know why. Check 4b proved nothing was left in either queue. When you can&#8217;t explain something, at least prove it left no damage.<\/p>\n<h3 class=\"wp-block-heading\">Why I chose this way<\/h3>\n<ul class=\"wp-block-list\">\n<li>The official emulator. It gives real Service Bus behaviour (locks, delivery counts, the dead-letter queue) without a cloud bill. An in-memory fake would only test my assumptions about Service Bus, not Service Bus itself. And real Azure Service Bus now would cost money, and needs Terraform that belongs to my next project.<\/li>\n<li>A Compose profile. About 0.9 GB that my AWS work doesn&#8217;t need.<\/li>\n<li>SQL Server Linux, because SQL Edge is retired.<\/li>\n<li>A separate env file, so the api and worker never see the SQL admin password.<\/li>\n<li>No published ports. Only Compose containers need them.<\/li>\n<li>The same lock and retry values as SQS, so tests and runbooks match on both clouds.<\/li>\n<li>No volume for SQL Server. Throwaway dev data, and Config.json recreates the queue on every start.<\/li>\n<\/ul>\n<p>Before this step, I asked what would happen if I used real Azure Service Bus instead of the emulator. It would mean creating a namespace now, by hand or with Terraform. But infrastructure belongs to Terraform in my next project, so a hand-made namespace would have to be replaced or imported later, and it would cost money while it exists. With the emulator, this project only needs a connection string from the environment. While answering that, I also noticed a gap: my next project&#8217;s plan doesn&#8217;t yet list a Service Bus namespace and queue in its Azure Terraform.<\/p>\n<h3 class=\"wp-block-heading\">What I learned<\/h3>\n<ul class=\"wp-block-list\">\n<li>Understand the broker before writing code for it. Four small checks taught me how Service Bus really behaves.<\/li>\n<li>Service Bus uses peek-lock: a delivery is locked, then completed, abandoned, dead-lettered, or left to expire.<\/li>\n<li>Settling happens on the receiver that holds the lock.<\/li>\n<li>The dead-letter queue is built in, and it records a reason.<\/li>\n<li>The delivery count starts at 0 on the emulator. Don&#8217;t copy SQS&#8217;s counting logic.<\/li>\n<li>AMQP keeps a long-lived connection, which HTTP doesn&#8217;t.<\/li>\n<li>Find image versions as numbers, never as text, and never use latest.<\/li>\n<li>Compose profiles keep heavy, optional services off by default.<\/li>\n<li>depends_on orders the start but doesn&#8217;t wait for readiness. A restart policy covers the gap.<\/li>\n<li>peek_messages is the safe way to look inside a queue.<\/li>\n<\/ul>\n<h3 class=\"wp-block-heading\">What comes next<\/h3>\n<p>The broker runs, and I know how it behaves. In Part 25, I write a second queue class, ServiceBusQueue, behind the same interface my publisher and worker already use. Keeping one receiver open between receive and delete turns out to be the easy part. The hard part is a health check that, with a frozen broker, could hang forever.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m sharing one of my projects here from the beginning, step by step. It&#8217;s a Job Board API built with Django, Django&hellip;<\/p>\n","protected":false},"author":2,"featured_media":327,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_rezaops_part":"24","_rezaops_linkedin_url":"https:\/\/www.linkedin.com\/pulse\/building-job-board-api-part-24-azure-service-bus-running-reza-chegini-ziuyc\/","footnotes":""},"categories":[50,10,116],"tags":[52,220,8,111,35,191,118,25,112],"series":[117],"class_list":["post-329","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-azure","category-devops","category-django","tag-azure","tag-azure-service-bus","tag-devops","tag-django","tag-docker","tag-drf","tag-job-board","tag-python","tag-rest-api","series-job-board-api"],"jetpack_featured_media_url":"https:\/\/rezachegini.com\/wp-content\/uploads\/2026\/11\/job-board-api-part-24-cover.png","_links":{"self":[{"href":"https:\/\/rezachegini.com\/index.php?rest_route=\/wp\/v2\/posts\/329","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rezachegini.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rezachegini.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rezachegini.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/rezachegini.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=329"}],"version-history":[{"count":1,"href":"https:\/\/rezachegini.com\/index.php?rest_route=\/wp\/v2\/posts\/329\/revisions"}],"predecessor-version":[{"id":330,"href":"https:\/\/rezachegini.com\/index.php?rest_route=\/wp\/v2\/posts\/329\/revisions\/330"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rezachegini.com\/index.php?rest_route=\/wp\/v2\/media\/327"}],"wp:attachment":[{"href":"https:\/\/rezachegini.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=329"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rezachegini.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=329"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rezachegini.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=329"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/rezachegini.com\/index.php?rest_route=%2Fwp%2Fv2%2Fseries&post=329"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}