Replaying Azure Event Hubs
Background
Azure Event Hubs has two ways in: a Kafka-compatible endpoint on port 9093, and AMQP 1.0, which the Azure Event Hubs SDKs use. Speedscale supports the Kafka endpoint, as Kafka. AMQP 1.0 is not supported yet.
| Client | Protocol | Support |
|---|---|---|
A Kafka client connected to <namespace>.servicebus.windows.net:9093 | Kafka over TLS, with SASL PLAIN | Record, mock and replay, as Kafka |
An Azure Event Hubs SDK, such as azure-messaging-eventhubs or Azure.Messaging.EventHubs | AMQP 1.0 | Not supported yet |
For more information about Azure Event Hubs, see the Azure Event Hubs documentation, and its guide to the Kafka endpoint.
Use the Kafka endpoint
Port 9093 is one of the ports Speedscale recognizes as Kafka, so a Kafka client's traffic to Event Hubs is recorded as Kafka once its TLS is decrypted: by the sidecar's TLS interception or the eBPF collector in a cluster. Everything in the proxymock message brokers section for Kafka then applies:
- Record Kafka traffic
- Mock a broker. The mock accepts SASL PLAIN with any credentials, so your app keeps its connection string.
- Test a consumer, and the Kafka guide for a replay in your cluster
A replay that produces to Event Hubs authenticates the way Kafka clients do with Event Hubs: SASL PLAIN, the username $ConnectionString, and the namespace's connection string, from Shared access policies in the Azure portal, as the password. Keep the connection string in a secret:
{
"generator": {
"kafka": {
"username": "$ConnectionString",
"password": "${{secret:event-hubs/connection-string}}",
"saslMechanism": "PROTOCOL_SASL_MECHANISM_PLAIN",
"tlsMode": "PROTOCOL_TLS_MODE_VERIFY_FULL"
}
}
}
The event hub's name is the Kafka topic. See Connect to the broker.
Write your own load driver
To publish recorded records to Event Hubs yourself, extract them from a snapshot and send them with a Kafka producer. Write your own load driver has the extraction path, the producer code and the Event Hubs settings.