WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

yang-xiaodong/Savorboard.CAP.InMemoryMessageQueue

Repository files navigation

Savorboard.CAP.InMemoryMessageQueue

A lightweight in-memory message queue transport for CAP.

Designed ONLY for local development, demos and automated tests. Do not use in production.

Build status NuGet License


Install

dotnet add package Savorboard.CAP.InMemoryMessageQueue

Features

  • Zero external dependencies
  • Works entirely in-memory (lifetime = process lifetime)
  • Publish / subscribe via standard CAP attributes
  • Fast startup, simple to configure
  • Great for unit / integration tests
  • .NET 8 compatible

Limitations

Not persistent. Not cross-process. Not clustered. Not durable. Not for performance benchmarking. Not for production. If the process stops, messages are gone.


Quick Start

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddCap(options =>
{
    options.DefaultGroup = "demo.group";
    options.UseInMemoryMessageQueue();
    // You can still configure a persistent storage component if needed.
});

var app = builder.Build();

app.MapGet("/publish", async (ICapPublisher cap) =>
{
    await cap.PublishAsync("demo.topic", new { Id = Guid.NewGuid(), Time = DateTimeOffset.UtcNow });
    return "Published";
});

app.Run();

Subscriber example:

public class DemoSubscriber
{
    [CapSubscribe("demo.topic")]
    public void Handle(dynamic payload)
    {
        Console.WriteLine($"Received: {payload.Id} at {payload.Time}");
    }
}

Configuration

Currently no extra tunable options:

options.UseInMemoryMessageQueue();

Sample

See samples/InMemorySample for a minimal runnable example.


Testing

dotnet test

Contributing

Issues and PRs welcome. Keep changes small and focused.


License

MIT


Summary

Use for development & tests only. Switch to a real queue for production workloads.

About

In-Memory message queue for CAP

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages