Skip to content

Core library for our Microservices, producing, consuming, metrics etc

License

Notifications You must be signed in to change notification settings

Coflnet/CoflnetCore

Repository files navigation

CoflnetCore

Core library for our Microservices, producing, consuming, metrics etc

Setup

Add services in your Startup.cs or Program.cs file

builder.Services.AddCoflnetCore();

[...]
// register middlewares before controllers
app.UseCoflnetCore();
app.MapControllers();

Usage

Consuming

public class ConsumeService : BackgroundService
{
    private readonly KafkaConsumer _consumer;

    public MyController(KafkaConsumer consumer)
    {
        _consumer = consumer;
    }


    protected override async Task ExecuteAsync(CancellationToken stoppingToken)
    {
        await _consumer.Consume<string>("my-topic", async (message) =>
        {
            // do something with the message
        }, stoppingToken);
    }
}

About

Core library for our Microservices, producing, consuming, metrics etc

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published