A test client for sending JSON format events to Azure Event Hubs or Kafka broker.
Node v18+
Or:
Docker
- Clone the repo and run
npm install
to install required npm packages - Update the preferred port in the
config.js
file. By default this is set to 3012.
- Run
npm start
to start the application.
- Run
docker-compose build
- Run
docker-compose up
docker run -p 3012:3012 johnwatson484/azure-event-hubs-test-client
A hosted version is available at https://aehtc.lynxmagnus.com/
The below screenshot shows an overview of the the client.
If using Azure Event Hubs then set this value to your Azure Event Hubs namespace. For example, myeventhub.servicebus.windows.net
If using Kafka then set this to the hostname of the broker. If running the client in a container and the broker is accessible on the host device's localhost. Then set this value to host.docker.internal
.
If using Azure Event Hubs this value is ignored. If using Kafka then set the port of the broker.
The client supports three methods for authentication.
- Connection String, for Azure Event Hubs authentication
- Username and password, for Kafka clients with plain authentication
- None, for Kafka clients with no authentication
This can be found in the Azure portal under Shared Access Policies for either the root account or a specific queue key.
This must be in the below format and note that the validation provided by the client is case sensitive. For example "endpoint=..." would be invalid. EntityPath is optional as it only applies to queue policies.
Endpoint=sb://YOUR_HOSTNAME/;SharedAccessKeyName=KEYNAME;SharedAccessKey=KEY;
This is the Event Hub where the event will be sent to.
This value will be added to the message body as a type
property.
This value will be added to the header metadata as a routingKey
property
This is the value that will be sent to the Event Hub and must be in JSON format.
Any ##
placeholders will be replaced by an auto incrementing integer.
The number of copies of the event to send.
If invalid credentials or malformed JSON is provided an error will be returned through the client.