This guide will help you get up and running with your free EventHub account in minutes. It’s short and sweet.
- Install the CLI
- Sign up for your free EventHub-Account
- Create your first event definition
- Implement the client SDK in your application
- Check event usage
Before creating an account and writing your first event definition, install the eventhub CLI. It’s open source and available on GitHub.
pip install eventhub-cli
Now that the eventhub CLI is installed on your operating system, let’s create an account. Run the signup command and claim yours:
eventhub-cli signup [YOUR_EMAIL] [YOUR_PASSWORD]
You now have your very own EventHub account! Go ahead and create an organization and a workspace.
Create a new file and save it as events.json
. Paste the following content:
{
"version": "0.0.0",
"events": [
{
"name": "hello.world",
"properties": {
"hello": "string",
"world": "string"
}
}
]
}
Use the eventhub CLI to upload the file into your workspace.
eventhub-cli push events.json -e [YOUR_EMAIL] -p [YOUR_PASSWORD] -o [YOUR_ORGANIZATION] -w [YOUR_WORKSPACE]
Install the eventhub client SDK:
pip install eventhub
Create a new file and save it as demo.py
. Paste the following content:
from eventhub import Eventhub
eventhub = Eventhub(base_url="https://eventhub-backend-dev.herokuapp.com/",
email="[YOUR_EMAIL]",
password="[YOUR_PASSWORD]",
organization_name="[YOUR_ORGANIZATION]",
workspace_name="[YOUR_WORKSPACE]",
app_name="demo-app")
test_data = {"hello": "hallo", "world": "welt"}
eventhub.validate_event("hello.world", test_data)
eventhub-cli usage hello.world -e [YOUR_EMAIL] -p [YOUR_PASSWORD] -o [YOUR_ORGANIZATION] -w [YOUR_WORKSPACE]