Simulating EventHub messages

This post has been republished via RSS; it originally appeared at: Microsoft Tech Community - Latest Blogs - .

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

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.