RickDotNet.Apollo 0.0.1-preview2

This is a prerelease version of RickDotNet.Apollo.
There is a newer version of this package available.
See the version list below for details.
dotnet add package RickDotNet.Apollo --version 0.0.1-preview2
NuGet\Install-Package RickDotNet.Apollo -Version 0.0.1-preview2
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="RickDotNet.Apollo" Version="0.0.1-preview2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RickDotNet.Apollo --version 0.0.1-preview2
#r "nuget: RickDotNet.Apollo, 0.0.1-preview2"
#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 RickDotNet.Apollo as a Cake Addin
#addin nuget:?package=RickDotNet.Apollo&version=0.0.1-preview2&prerelease

// Install RickDotNet.Apollo as a Cake Tool
#tool nuget:?package=RickDotNet.Apollo&version=0.0.1-preview2&prerelease

Apollo

Apollo is a lightweight, high-performance messaging platform built on top of the NATS messaging system. It is designed to provide developers with a simple yet powerful way to incorporate flexible architectures into their .NET applications. With Apollo, you can easily handle events, commands, and requests with minimal configuration, while benefiting from the speed and scalability of NATS.

Planned Features

  • Simple Configuration: Set up your messaging handlers and publishers with just a few lines of code.
  • Auto-wiring of Consumers: Apollo automatically discovers and wires up your message handlers, making it easy to scale your system.
  • Integration with .NET Core: Designed to work seamlessly with the .NET Core dependency injection system.
  • High Throughput: Leverages the performance of NATS to handle high volumes of messages efficiently.
  • Flexible Serialization: Supports various serialization formats to suit your needs.
  • Scalability: Scales horizontally as your application grows, thanks to the underlying NATS infrastructure.
  • Resilience: Built-in fault tolerance and message retry mechanisms to ensure reliable message delivery.

Getting Started

To get started with Apollo, you'll need to have a running instance of NATS. You can find instructions on setting up NATS here.

Current Usage

The API is very much in design right now. This is the current POC usage.

var config = new ApolloConfig("nats://localhost:4222");

var builder = Host.CreateApplicationBuilder(args);

builder.Services
    .AddApollo(config)
    .WithEndpoints(
        endpoints =>
        {
            endpoints.AddEndpoint<MyEndpoint>(
              cfg =>
                {
                  cfg.IsLocalEndpoint = true;
                  cfg.ConsumerName = "DifferentConsumerName";
                });
            endpoints.AddEndpoint<MyOtherEndpoint>(
              cfg =>
                {
                  cfg.IsLocalEndpoint = true;
                  cfg.ConsumerName = "MyOtherEndpoint";
                }
              );
        });

var host = builder.Build();

var localDispatcher = host.Services.GetRequiredService<ILocalPublisher>();
//var remoteDispatcher = host.Services.GetRequiredService<IRemotePublisher>();

await localDispatcher.BroadcastAsync(new TestMessage("Local Test Event"));
//await remoteDispatcher.SendCommandAsync(new TestCommand("Remote Test Command"));

await host.RunAsync();
public class MyEndpoint : IListenFor<TestMessage>, IHandle<TestCommand>
{
    public ValueTask HandleEventAsync(TestMessage message, CancellationToken cancellationToken = default)
    {
        Console.WriteLine($"MyEndpoint Received: {message.Message}");
        return ValueTask.CompletedTask;
    }


    public ValueTask HandleCommandAsync(TestCommand message, CancellationToken cancellationToken)
    {
        Console.WriteLine($"MyEndpoint Received: {message.Message}");
        return ValueTask.CompletedTask;
    }
}
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 (3)

Showing the top 3 NuGet packages that depend on RickDotNet.Apollo:

Package Downloads
RickDotNet.Apollo.Lock

Distributed messaging built on top of NATS.

RickDotNet.Apollo.Messaging

Distributed messaging built on top of NATS.

RickDotNet.Apollo.Caching

Distributed messaging built on top of NATS.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.2.1 106 4/27/2024
0.2.0 117 4/13/2024
0.1.1 122 3/24/2024
0.1.0 97 3/20/2024
0.0.5 86 3/10/2024
0.0.4 93 3/8/2024
0.0.3 106 3/3/2024
0.0.2-preview1 81 1/20/2024
0.0.1 159 1/8/2024
0.0.1-preview2 63 1/8/2024
0.0.1-preview 70 1/8/2024