Azure Event Hubs Endpoint
Use the Azure Event Hubs endpoint when LoadStrike needs produce or consume flows with stable partition and correlation behavior.
Matching docs
Search across docs titles, summaries, groups, and section headings.
Use Up and Down Arrow to move through results, then press Enter to open the active page.
No indexed docs matched that search. Try a broader term or open the docs hub.
What this page helps you do
What this page helps you do
Use the Azure Event Hubs endpoint when LoadStrike needs produce or consume flows with stable partition and correlation behavior.
Who this is for
Teams defining the transport-specific source or destination side of a correlated transaction.
Prerequisites
- A stable tracking field shared between the producer side and the consumer or completion side
By the end
A transport definition that matches the transaction you need to measure.
Use this page when
Use this page when Azure Event Hubs Endpoint is the source or destination side of the transaction and you need the documented endpoint fields before wiring the scenario.
Visual guide
Guide
Connection Settings
Use ConnectionString to tell LoadStrike how to connect to the Event Hubs namespace, and EventHubName to point it at the correct hub. Those two values are the base of both produce and consume configurations.
Consumer Groups
Use dedicated consumer groups when the test needs predictable isolation from other consumers. That makes it easier to reason about what the LoadStrike run is actually reading.
Partition Routing And Tracking
Use PartitionId when you must pin consume-side reads or explicit produce-side writes to one partition. PartitionKey is an optional produce-side routing key, and PartitionId wins when both are set. In Go, leaving PartitionCount unset or zero omits both the partition ID and partition key from the batch, so Azure chooses normal routing and PartitionKey has no routing effect; a positive PartitionCount enables Go to derive a partition ID. There is no universal default count or cross-SDK hash guarantee for overflow or non-ASCII keys. TrackingField still defines the business ID used for correlation.
Python Installation
Python native Azure Event Hubs endpoints require `pip install loadstrike[eventhubs]`. Use `pip install loadstrike[all-transports]` when the same test project needs every optional transport client.
Endpoint definition samples
Use these samples to see how Azure Event Hubs Endpoint is represented as a source or destination endpoint before you attach it to a correlated scenario.
If you run these examples locally, add a valid runner key before execution starts. Set it with WithRunnerKey("...") or the config key LoadStrike:RunnerKey.
Event Hubs Endpoint
using LoadStrike;
var tracking = new CrossPlatformTrackingConfiguration
{
Source = new AzureEventHubsEndpointDefinition
{
Name = "eh-in",
Mode = TrafficEndpointMode.Produce,
TrackingField = TrackingFieldSelector.Parse("json:$.trackingId"),
ConnectionString = "<connection-string>",
EventHubName = "orders",
PartitionKey = "customer-a",
PartitionCount = 8,
MessagePayload = new { trackingId = "trk-1001", amount = 49.95m }
},
Destination = new AzureEventHubsEndpointDefinition
{
Name = "eh-out",
Mode = TrafficEndpointMode.Consume,
TrackingField = TrackingFieldSelector.Parse("json:$.trackingId"),
ConnectionString = "<connection-string>",
EventHubName = "orders"
}
};
var scenario = CrossPlatformScenarioConfigurator
.Configure(LoadStrikeScenario.Empty("orders-http-to-event-hubs"), tracking)
.WithLoadSimulations(LoadStrikeSimulation.Inject(10, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(20)));
LoadStrikeRunner.RegisterScenarios(scenario)
.WithRunnerKey("rkl_your_local_runner_key")
.Run();
package main
import loadstrike "loadstrike.com/sdk/go"
var eventHubsEndpoint = &loadstrike.EndpointSpec{
Kind: "AzureEventHubs",
Name: "orders-event-hub",
Mode: "Consume",
TrackingField: "json:$.trackingId",
AzureEventHubs: &loadstrike.AzureEventHubsEndpointOptions{
ConnectionString: "Endpoint=sb://example.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=key",
EventHubName: "orders",
ConsumerGroup: "$Default",
StartFromEarliest: true,
},
}
import com.loadstrike.runtime.AzureEventHubsEndpointDefinition;
import com.loadstrike.runtime.CrossPlatformScenarioConfigurator;
import com.loadstrike.runtime.CrossPlatformTrackingConfiguration;
import com.loadstrike.runtime.LoadStrikeCorrelation.TrackingFieldSelector;
import com.loadstrike.runtime.LoadStrikeRuntime.LoadStrikeRunner;
import com.loadstrike.runtime.LoadStrikeRuntime.LoadStrikeScenario;
import com.loadstrike.runtime.LoadStrikeRuntime.LoadStrikeSimulation;
import com.loadstrike.runtime.LoadStrikeTransports;
var source = new AzureEventHubsEndpointDefinition();
source.name = "eh-in";
source.mode = LoadStrikeTransports.TrafficEndpointMode.Produce;
source.trackingField = TrackingFieldSelector.parse("json:$.trackingId");
source.connectionString = "<connection-string>";
source.eventHubName = "orders";
source.partitionKey = "customer-a";
source.partitionCount = 8;
source.messagePayload = java.util.Map.of("trackingId", "trk-1001", "amount", 49.95);
var destination = new AzureEventHubsEndpointDefinition();
destination.name = "eh-out";
destination.mode = LoadStrikeTransports.TrafficEndpointMode.Consume;
destination.trackingField = TrackingFieldSelector.parse("json:$.trackingId");
destination.connectionString = "<connection-string>";
destination.eventHubName = "orders";
var tracking = new CrossPlatformTrackingConfiguration();
tracking.source = source;
tracking.destination = destination;
var scenario = CrossPlatformScenarioConfigurator.Configure(
LoadStrikeScenario.empty("orders-http-to-event-hubs"),
tracking
).withLoadSimulations(LoadStrikeSimulation.inject(10, 1d, 20d));
LoadStrikeRunner
.registerScenarios(scenario)
.withRunnerKey("rkl_your_local_runner_key")
.run();
from loadstrike_sdk import CrossPlatformScenarioConfigurator, LoadStrikeRunner, LoadStrikeScenario, LoadStrikeSimulation
tracking = {
"Source": {
"Kind": "AzureEventHubs",
"Name": "eh-in",
"Mode": "Produce",
"TrackingField": "json:$.trackingId",
"ConnectionString": "<connection-string>",
"EventHubName": "orders",
"PartitionKey": "customer-a",
"PartitionCount": 8,
"MessagePayload": {"trackingId": "trk-1001", "amount": 49.95},
},
"Destination": {
"Kind": "AzureEventHubs",
"Name": "eh-out",
"Mode": "Consume",
"TrackingField": "json:$.trackingId",
"ConnectionString": "<connection-string>",
"EventHubName": "orders",
},
}
scenario = (
CrossPlatformScenarioConfigurator.Configure(
LoadStrikeScenario.empty("orders-http-to-event-hubs"),
tracking,
)
.with_load_simulations(LoadStrikeSimulation.inject(10, 1, 20))
)
LoadStrikeRunner.register_scenarios(scenario) \
.with_runner_key("rkl_your_local_runner_key") \
.run()
import {
CrossPlatformScenarioConfigurator,
LoadStrikeRunner,
LoadStrikeScenario,
LoadStrikeSimulation,
TrackingFieldSelector
} from "@loadstrike/loadstrike-sdk";
const tracking = {
Source: {
Kind: "AzureEventHubs",
Name: "eh-in",
Mode: "Produce",
TrackingField: new TrackingFieldSelector("Json", "$.trackingId"),
ConnectionString: "<connection-string>",
EventHubName: "orders",
PartitionKey: "customer-a",
PartitionCount: 8,
MessagePayload: { trackingId: "trk-1001", amount: 49.95 }
},
Destination: {
Kind: "AzureEventHubs",
Name: "eh-out",
Mode: "Consume",
TrackingField: new TrackingFieldSelector("Json", "$.trackingId"),
ConnectionString: "<connection-string>",
EventHubName: "orders"
}
};
const scenario = CrossPlatformScenarioConfigurator
.Configure(LoadStrikeScenario.empty("orders-http-to-event-hubs"), tracking)
.withLoadSimulations(LoadStrikeSimulation.inject(10, 1, 20));
await LoadStrikeRunner
.registerScenarios(scenario)
.withRunnerKey("rkl_your_local_runner_key")
.run();
const {
CrossPlatformScenarioConfigurator,
LoadStrikeRunner,
LoadStrikeScenario,
LoadStrikeSimulation,
TrackingFieldSelector
} = require("@loadstrike/loadstrike-sdk");
(async () => {
const tracking = {
Source: {
Kind: "AzureEventHubs",
Name: "eh-in",
Mode: "Produce",
TrackingField: new TrackingFieldSelector("Json", "$.trackingId"),
ConnectionString: "<connection-string>",
EventHubName: "orders",
PartitionKey: "customer-a",
PartitionCount: 8,
MessagePayload: { trackingId: "trk-1001", amount: 49.95 }
},
Destination: {
Kind: "AzureEventHubs",
Name: "eh-out",
Mode: "Consume",
TrackingField: new TrackingFieldSelector("Json", "$.trackingId"),
ConnectionString: "<connection-string>",
EventHubName: "orders"
}
};
const scenario = CrossPlatformScenarioConfigurator
.Configure(LoadStrikeScenario.empty("orders-http-to-event-hubs"), tracking)
.withLoadSimulations(LoadStrikeSimulation.inject(10, 1, 20));
await LoadStrikeRunner
.registerScenarios(scenario)
.withRunnerKey("rkl_your_local_runner_key")
.run();
})();
Azure Event Hubs endpoint fields and parameters
Required endpoint identifier. It appears in correlation tables, sink exports, and troubleshooting messages, so choose a stable descriptive name.
Choose Produce when LoadStrike should create traffic, or Consume when it should listen for downstream traffic. Run mode validation checks that the selected mode matches the source or destination role.
Selector that extracts the correlation id from a header or JSON body. It is normally required, but can be omitted when UseLoadStrikeTraceIdHeader is true so LoadStrike uses header:loadstrike-trace-id for generated source traffic. Selector prefixes such as header: and json: are parsed case-insensitively, but the header name or JSON path segments after the prefix must match exact casing. The extracted value is matched case-sensitively by default unless TrackingFieldValueCaseSensitive is turned off on the tracking configuration.
Optional destination-only selector used for grouped correlation reports. It follows the same selector-casing rules as TrackingField. Group values are grouped case-sensitively by default unless GatherByFieldValueCaseSensitive is turned off on the tracking configuration.
Defaults to true. When the source payload does not already contain the tracked id, LoadStrike can inject one so the generated traffic still produces a correlation key.
Defaults to false. When true and TrackingField is omitted, produced source messages receive a loadstrike-trace-id header with a GUID value. Consume-mode source endpoints and CorrelateExistingTraffic runs do not inject this header; they only observe it if the existing traffic already contains it.
Controls how often a consumer-style endpoint polls for new messages. The value must stay greater than zero whenever you set it explicitly.
Optional headers that are written with produced traffic and also influence tracking extraction when the selector targets headers. Header names are preserved exactly as you set them, and header selectors later match using that same exact casing.
Optional object or body value sent by producer-style endpoints. This is the payload your scenario is actually placing on the wire.
Optional type hint used when JSON selectors need typed parsing. Leave it unset when dynamic JSON parsing is enough.
Optional serializer settings for System.Text.Json or Newtonsoft.Json. Use them only when the payload shape or naming strategy requires custom parsing behavior.
Optional explicit content type for custom payload handling. This is most helpful for delegate-style transports or non-default HTTP body shapes.
Required Event Hubs namespace connection string.
Required Event Hub name.
Consumer group used for consume mode. It defaults to $Default.
Enable this when the consumer should start at the earliest retained events instead of only new ones.
Optional partition targeting field for consume-side reads when the test must stay on one partition.
Optional produce-side routing key used when PartitionId is not explicitly set. In Go, leaving PartitionCount unset or zero omits both the partition ID and partition key from the batch, so Azure chooses normal routing and PartitionKey has no routing effect. With a positive PartitionCount, Go derives a partition ID; do not rely on that derived ID matching another SDK for overflow or non-ASCII keys.
Optional produce-side count used only when the selected SDK documents client-side partition derivation. There is no universal default of 4. In Go, only a value greater than zero enables derived partition-ID routing; an explicit PartitionId still wins.
{ "trackingId": "trk-1" }