NeoBus 1.4.2

dotnet add package NeoBus --version 1.4.2                
NuGet\Install-Package NeoBus -Version 1.4.2                
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="NeoBus" Version="1.4.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NeoBus --version 1.4.2                
#r "nuget: NeoBus, 1.4.2"                
#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 NeoBus as a Cake Addin
#addin nuget:?package=NeoBus&version=1.4.2

// Install NeoBus as a Cake Tool
#tool nuget:?package=NeoBus&version=1.4.2                

NeoBus

NeoBus is a powerful library that enables you to send commands, queries, and events using the CQRS pattern in .NET. It simplifies the implementation of distributed systems and event-driven architectures by seamlessly integrating with Kafka. If you find NeoBus helpful, please consider giving it a star ⭐ to show your support.

Installation

You can easily install NeoBus via NuGet Package Manager:

> Install-Package NeoBus

Configuration

To configure NeoBus, add the following settings to your appsettings.json file and specify your Kafka server address:

"NeoBus": {
    "Kafka": {
        "Servers": ["localhost:9092"]
    }
}

Registration

Incorporate NeoBus into your project by registering it in the Startup.cs file within the ConfigureServices method:

services.AddNeoBus(Assembly.GetExecutingAssembly());

Distributed Events (Kafka)

For distributed events using Kafka, register the necessary services as follows:

services.AddHostedService<KafkaEventSubscriberService<ProductAddedEventOnKafka, ProductAddedEventOnKafkaHandler>>();
services.AddSingleton<ProductAddedEventOnKafkaHandler>();

If you are using a version lower than 1.2.0, use the following code to register and manually register commands and queries:

services.AddNeoBus();

Registering Commands, Queries, and In-Memory Events

To register commands and queries, follow these steps:

Command and Query Handlers:
services.AddScoped<IRequestHandler<ProductAddCommand, CommandResult>, ProductAddCommandHandler>();
services.AddScoped<IRequestHandler<GetProductQuery, CommandResult>, GetProductQueryHandler>();
In-Memory Event Handlers:
services.AddScoped<INotificationHandler<ProductAddedEvent>, ProductAddedEventHandler>();

Sample Project

Explore a sample project that demonstrates how to use NeoBus:

Sample For Use NeoBus

Setting Up Kafka with Docker Compose

To run Kafka locally, follow these instructions:

  1. Install Docker on your local machine.
  2. Download the docker-compose-kafka.yml file from within the project solution.
  3. Open your Terminal as an administrator.
  4. Navigate to the directory containing the docker-compose-kafka.yml file.
  5. Run the following command:
docker-compose -f docker-compose-kafka.yml up

Now Kafka is up and running in a Docker container.

Learn More

For more information about NeoBus and its applications, consider reading the following articles:

  1. EventBus Application and Introduction of NeoBus Package
  2. کاربرد EventBus و معرفی پکیج NeoBus (Persian)

Feel free to explore these resources to enhance your understanding of NeoBus and its capabilities.

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
1.4.2 81 5/19/2024
1.4.1 178 3/1/2024
1.3.0 391 8/19/2023
1.2.0 750 6/4/2022
1.1.1 728 6/2/2022
1.0.4 836 5/30/2021

upgrade to .NET 8.0