All posts

Introducing EventNet, a tool for resting EventBridge events

Portrait of Steve Morland
February 1, 2024
5 min read
Our Chief Technical Officer Steve Morland with the on:tech logo overlaid.

Testing asynchronous events is one of the more significant challenges of being able to validate event-driven architecture.

In the synchronous world, we have a direct response to any action, but when triggering asynchronous events, we have to be able to collect them after the fact.

There are many different ways to tackle this problem, all of which have benefits and trade-offs. We’ve never been 100% happy with all the current solutions at Leighton. Over the past year, we have developed our internal way of collecting these as part of customer projects, but we thought it was only fitting to release this publicly.

We’ve entirely rewritten an internal tool called EventNet and upgraded the dependencies to track the latest CDK release and use v3 of the AWS SDK. As such, there are a few features that we still have to move over. The Leighton team will continue to add and refine.

What is EventNet?

EventNet is made up of three parts:

1. A CDK construct to be used on test builds that captures events and sends them through a WebSocket. This real-time delivery avoids using queues or other mechanisms to get them to the test suite as soon as possible.

2. An EventNet client connects to your WebSocket and collects events captured by the CDK construct, enabling you to test event producers. The client also lets you send events to the bus to test event consumers.

3. A Jest Assertion to check event fidelity against JSON schemas.

For more information, visit our on:tech publication on Medium or head straight to the GitHub repo here.

Share this post
Portrait of Steve Morland
February 1, 2024
5 min read
All posts
Our Chief Technical Officer Steve Morland with the on:tech logo overlaid.

Introducing EventNet, a tool for resting EventBridge events

Testing asynchronous events is one of the more significant challenges of being able to validate event-driven architecture.

In the synchronous world, we have a direct response to any action, but when triggering asynchronous events, we have to be able to collect them after the fact.

There are many different ways to tackle this problem, all of which have benefits and trade-offs. We’ve never been 100% happy with all the current solutions at Leighton. Over the past year, we have developed our internal way of collecting these as part of customer projects, but we thought it was only fitting to release this publicly.

We’ve entirely rewritten an internal tool called EventNet and upgraded the dependencies to track the latest CDK release and use v3 of the AWS SDK. As such, there are a few features that we still have to move over. The Leighton team will continue to add and refine.

What is EventNet?

EventNet is made up of three parts:

1. A CDK construct to be used on test builds that captures events and sends them through a WebSocket. This real-time delivery avoids using queues or other mechanisms to get them to the test suite as soon as possible.

2. An EventNet client connects to your WebSocket and collects events captured by the CDK construct, enabling you to test event producers. The client also lets you send events to the bus to test event consumers.

3. A Jest Assertion to check event fidelity against JSON schemas.

For more information, visit our on:tech publication on Medium or head straight to the GitHub repo here.

Download
To download the assets, please enter your details below:
By completing this form, you provide your consent to our processing of your information in accordance with Leighton's privacy policy.

Thank you!

Use the button below to download the file. By doing so, the file will open in a separate browser window.
Download now
Oops! Something went wrong while submitting the form.
By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.