https://github.com/martinstanek/edgemq
The simple & fast persistent queue targetting low resource systems
https://github.com/martinstanek/edgemq
edge edge-computing message queueing
Last synced: 2 months ago
JSON representation
The simple & fast persistent queue targetting low resource systems
- Host: GitHub
- URL: https://github.com/martinstanek/edgemq
- Owner: martinstanek
- Created: 2024-12-14T09:39:41.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-02-12T19:34:29.000Z (3 months ago)
- Last Synced: 2025-03-12T13:37:43.857Z (2 months ago)
- Topics: edge, edge-computing, message, queueing
- Language: C#
- Homepage:
- Size: 1.13 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## The EdgeMq
*... a simple (like seriously and naively simple), lightweight queue designed to have a minimal memory footprint*
Multi producer, single consumer & plenty of space for improvements.

[](https://awitec.visualstudio.com/Awitec/_build/latest?definitionId=52)
[](https://www.nuget.org/packages/Awitec.EdgeMq.Client)
[](https://www.nuget.org/packages/Awitec.EdgeMq.TestContainer)

### Producer
```csharp
var httpClient = new HttpClient { BaseAddress = new Uri("http://localhost:2323") };
var config = new EdgeMqClientConfiguration { ApiKey = "123" };
var edgeMqClient = new EdgeMqClient(httpClient, config);await edgeMqClient.EnqueueAsync("test-queue", "hello world!");
```### Consumer
```csharp
var httpClient = new HttpClient { BaseAddress = new Uri("http://localhost:2323") };
var config = new EdgeMqClientConfiguration { ApiKey = "123" };
var edgeMqClient = new EdgeMqClient(httpClient, config);await edgeMqClient.DequeueAsync("test-queue", batch, timeOut: TimeSpan.FromSeconds(1), messages =>
{
foreach (var message in messages)
{
Console.WriteLine(message.Payload);
}return Task.CompletedTask;
}, CancellationToken.None);
```### Server
```
UI -> http://localhost:2323/
OpenApi -> http://localhost:2323/openapi/v1.json
Scalar -> http://localhost:2323/scalar/
API -> http://localhost:2323/v1/queues
```
### DockerAvailable Docker Tags: https://hub.docker.com/repository/docker/awitec/edgemq/tags
### Compose
```yml
services:edgemq:
hostname: edgemq
container_name: edgemq
image: "awitec/edgemq:latest-arm64"
ports:
- 2323:2323
environment:
- EDGEMQ_APIKEY=123
- EDGEMQ_PATH=/data/queues
- EDGEMQ_QUEUES=queue1, queue2
- EDGEMQ_STOREMODE=FileSystem
- EDGEMQ_CONSTRAINTSMODE=Ignore
- EDGEMQ_MAXCOUNT=100000
- EDGEMQ_MAXSIZEBYTES=10485760
- EDGEMQ_MAXBUFFERCOUNT=1000
- EDGEMQ_MAXBUFFERSIZEBYTES=1048576
- EDGEMQ_PAYLOADSIZEBYTES=1024
- EDGEMQ_BATCHSIZE=100
volumes:
- edgemqdata:/data
- /etc/localtime:/etc/localtime:ro
restart: unless-stoppedvolumes:
edgemqdata:
```When no env. vars provided, the server will default to InMemory mode without any API key.
### Testing
The test container NuGet can be used for the derived integration tests, (the default architecture is arm64) ie.:
```csharp
[Fact]
public async Task GetClient_ContainerIsCreated_ClientReturned()
{
await using var testContainer = new EdgeQueueTestContainer();if (!await testContainer.IsTestable())
{
return;
}var client = await testContainer.GetClientAsync(
testContainerName: "my-test-container",
testQueueName: "my-test-queue",
EdgeQueueTestContainer.ImageArchitecture.Amd64);
var queues = await client.GetQueuesAsync();queues.Queues.ShouldNotBeEmpty();
}
```Happy Queueing,\
Martin