Azure Service Bus Simulator
Tags: azure, azureservicebus, simulator, csharp
Published: 2024-01-07 14:01:43

TL;DR? check the repository:
[https://github.com/PejmanNik/lazvard-message](https://github.com/PejmanNik/lazvard-message)

---

In the intricate world of software development and testing, simulating server environments is not just a luxury, it’s a necessity. This is particularly true for those integrating Azure Service Bus into their tech stacks. The frustration is real for anyone searching “Azure Service Bus Simulator,” due to the lack of viable, straightforward solutions.

The challenge intensifies when debugging applications locally. The standard approach is to set up a Service Bus instance in Azure. This is fine for solo projects, but with enterprise-level applications, the complexity multiplies. Each developer needing a separate instance isn’t just cumbersome, it’s a nightmare.

In my typical fashion, I thought, “Why not build a simulator 🤔” This seemed simple, but I was in for a surprise 🫣.

Delving into this project, I quickly realized that Azure Service Bus is more than just an AMQP protocol message broker. It involves custom behaviors and logic, requiring meticulous reverse engineering, including inspecting Azure Service Bus responses and exploring client test suites.

But there’s more to it than simulating the message broker behavior., Azure Service Bus relies on secure communication, so the simulator had to function over HTTPS. After several attempts, I ended up Copy/Pasting 🧑‍💻dotnet dev-certs tools (From Microsoft ASP.NET Core) source code into the project, which efficiently generates a self-signed certificate and adds it to the operating system’s trusted certificates list.

However, this approach works flawlessly on macOS and Windows, but Linux users face challenges in trusting certificates, requiring manual addition of the trusted certificate, which is inconvenient 😶‍🌫️.

Navigating these challenges, my quest to create a lightweight Azure Service Bus simulator was a rollercoaster of disappointment and regret. Finally, “Lazvard Message” was born 🐣. It adeptly mirrors Azure Service Bus, but it is possible to encounter varying behaviors between the simulator and the actual Service Bus. If you spot any quirky behaviors, please create an issue in the GitHub repository.

[https://github.com/PejmanNik/lazvard-message](https://github.com/PejmanNik/lazvard-message)

Lazvard Message is a compact CLI tool designed for simplicity. To use it, you only need to add your queue, topic, and subscription to the configuration and then run the CLI. It doesn’t yet offer all the features of Azure Service Bus, with aspects like Message Sessions and Transactions still under development.

---
The name ‘Lazvard’ (LAZH-vard) is derived from an alternative Persian pronunciation of ‘lazuli’, referring to a vivid blue mineral from which the color Azure derives its name.

Wikipedia:
> The color azure ultimately takes its name from the intense blue mineral lapis lazuli. Lapis is the Latin word for “stone” and lāzulī is the genitive form of the Medieval Latin lāzulum, which is taken from the Arabic لازورد lāzaward, itself from the Persian لاژورد lāžaward, which is the name of the stone in Persian and also of a place where lapis lazuli was mined