Azure Event Hubs Local Emulator - End to End
Introduction
Want to learn Azure Event Hubs but don’t have an Azure account or free credits? No credit card? Worried about the charges? No problem!
In this article, I’ll show you how to use the Azure Event Hubs Emulator, a setup recently released by Microsoft. It runs two Docker containers to create a fake Azure Event Hubs environment right on your local machine. Once it’s set up, you can develop and learn Event Hubs without needing any Azure connection or login. It’s completely separate from any account, and the best part? It’s all local, so you can run everything even without an internet connection.
The setup is pretty easy, they have provided a powershell script which creates the docker setup. After that its just connect-and-code.
What You Need
Here’s what you need on your machine:
- Docker Desktop: If you don’t have it, grab it from their website.
- VS Code and Python: You’ll need these, along with Jupyter Notebook and a few plugins. If something doesn’t work, just install the necessary plugin.
Setting It Up
-
Get the Emulator: Head over to the GitHub page and download the zip file.
-
Unzip and Get Ready: Unzip the file to a folder on your computer.
-
Start Docker: Launch Docker Desktop.
-
Run the Script:
- Open PowerShell as an admin (right-click and choose “Run as administrator”).
- Run this command to allow scripts to run:
Start-Process powershell -Verb RunAs -ArgumentList 'Set-ExecutionPolicy Bypass –Scope CurrentUser'
- Navigate to
\EventHub-Emulator\Scripts\Windows
in the unzipped folder and run:.\LaunchEmulator.ps1
- You should be able to see two containers running.
Lets test the Fake Local Event Hubs
Now that your fake, free, local Azure Event Hubs environment is up and running, let’s see if it actually works:
-
Check the Logs: In Docker, click on the
eventhubs-emulator
container to view the logs. This will give you the connection info:- Namespace:
emulatorns1
- Event Hub:
eh1
- Consumer Groups:
cg1
and$default
- Namespace:
-
Run the Notebook: Instead of cluttering this guide with code, I’ve put everything you need into a Jupyter notebook. Just download it here, and run it cell by cell. The setup is straightforward, and the code should run smoothly.
Resources
Here are a couple of links you might find useful:
That's it! Now you have your own local setup to practice with Azure Event Hubs without any of the usual hassles. Enjoy!
If you have questions, reach out to me at das.d@hotmail.com