Blog Post

FastTrack for Azure
1 MIN READ

Simulating EventHub messages

yodobrin's avatar
yodobrin
Icon for Microsoft rankMicrosoft
Jun 09, 2022

The why:

Using Event Hubs for streaming based solutions is a common architecture, used in multiple industries. When testing these types of solutions, I am usually faced with the question: how we can quickly simulate flow of events, ensuring all components in the solutions are coping with a load. This public repository was created exactly for this reason. 

 

The How:

The concept is simple, two Azure functions are used. 

  • The first function listens to an HTTPs POST request, with simple json payload: {"spawnFactor":4000}.
    • It will generate <spawnFactor> EventGrid messages.
  • The second function is triggered by the EventGrid.
    • Each function instance will send a single message to the EventHub defined in the settings.
    • The messages sent are flat, simple objects with GUID and a time-based name. 

The "Architecture":

 

Using an EventGrid to trigger the second function is used for two reasons:

  • It is super fast to flud an EventGrid with thousands of messages
  • EventGrid trigger has the preferable auto scaler. For more information on scaler see documentation

 

 

Updated Jun 09, 2022
Version 1.0
No CommentsBe the first to comment

Share