EventHighway 0.5.0

dotnet add package EventHighway --version 0.5.0                
NuGet\Install-Package EventHighway -Version 0.5.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EventHighway" Version="0.5.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EventHighway --version 0.5.0                
#r "nuget: EventHighway, 0.5.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EventHighway as a Cake Addin
#addin nuget:?package=EventHighway&version=0.5.0

// Install EventHighway as a Cake Tool
#tool nuget:?package=EventHighway&version=0.5.0                

<div style="margin: 15px" align=center> <img style="width: 30%; margin: 15px;" src="https://raw.githubusercontent.com/hassanhabib/EventHighway/refs/heads/main/EventHighway.Core/EventHighwayLogo.png"/> </div>

.NET Nuget Nuget The Standard - COMPLIANT The Standard The Standard Community

0/ EventHighway

EventHighway is Standard-Compliant .NET library for event-driven programming. It is designed to be simple, lightweight, and easy to use.

0.1/ High-Level Flow

image

0.2/ In-Depth Architecture

<img width="1400" alt="image" src="https://github.com/user-attachments/assets/a9c00896-6879-4832-83c6-f12923a226bd">

1/ How to Use

1.0/ Installation

You must define a connection string that points to a SQL DB Server when initializing the EventHighway client as follows:

var eventHighway = new EventHighway("Server=.;Database=EventHighwayDB;Trusted_Connection=True;");

1.1/ Registering Event Address

In order for an event to be published, it must target a certain EventAddress. You can register an EventAddress as follows:

var eventAddress = new EventAddress 
{
	Id = Guid.NewGuid(),
	Name = "EventAddressName",
	Description = "EventAddressDescription"
	CreatedDate = DateTimeOffset.UtcNow,
	UpdatedDate = DateTimeOffset.UtcNow
};

await eventHighway.EventAddresses.RegisterEventAddressAsync(eventAddress);

Make sure you store your EventAddress Id in a safe place, as you will need it to publish events to that address.

1.2/ Registering Event Listeners

In order to listen to events, you must register an EventListener as follows:

var eventListener = new EventListener
{
	Id = Guid.NewGuid(),
	Endpoint = "https://my.endpoint.com/api/v1.0/students",
	EventAddressId = SomePreconfiguredEventAddressId,
	CreatedDate = DateTimeOffset.UtcNow,
	UpdatedDate = DateTimeOffset.UtcNow
};

await eventHighway.EventListeners.RegisterEventListenerAsync(eventListener);

1.3/ Publishing Events

You can publish an event as follows:

var event = new Event
{
	Id = Guid.NewGuid(),
	EventAddressId = SomePreconfiguredEventAddressId,
	Content = "SomeStringifiedJsonContent",
	CreatedDate = DateTimeOffset.UtcNow,
	UpdatedDate = DateTimeOffset.UtcNow
};

await eventHighway.Events.PublishEventAsync(event);

When an event is published, a notification will be sent to all registered EventListeners that are listening to the event's EventAddress. A record of the status of the published event per listener will be available through the ListenerEvent table in the database.

Note

This is an early release of a Pub/Sub pattern core library which can be deployed within an API or simple Console Application. It was intentionally built to be platform agnostic so it can process events from anywhere to anywhere.

There are plans for more abstraction and customization in the future, such as:

  • Enable plugging anything that implements IStorageBroker so consumers can use any storage mechanism or technology they prefer.
  • Enable eventing beyond RESTful APIs. Like running the library within one microservice from Service to Service in a LakeHouse model.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.5.0 126 11/18/2024
0.4.0 71 11/18/2024
0.3.0 71 11/18/2024
0.2.0 93 11/10/2024
0.1.1 112 11/4/2024
0.1.0 79 11/4/2024