Simulating EventHub messages
Published Jun 09 2022 03:41 AM 1,826 Views
Microsoft

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":

 

yodobrin_1-1654757658120.png

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

 

 

Co-Authors
Version history
Last update:
‎Jun 09 2022 01:00 AM
Updated by: