Skip to content
DsnielsPublic

About

RabbitMQ Library for .net

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

15 Commits

Folders and files

Repository files navigation

RabbitMQ Library for .net

Download the source files, and add the reference to your project, or download the nuget packages via github

Add the service

    services.AddMyTransit();

Setup consumers

    services.AddMyTransit(opts =>
    {
        opts.AddConsumer<ConsumerEvent>();
    });

Publisher

        var bus = scope.ServiceProvider.GetRequiredService<IBus>();
        await bus.PublishAsync(new Message<EventType>
        {
            MessageId = Guid.NewGuid().ToString(),
            CorrelationalId = Guid.NewGuid().ToString(),
            Payload = new EventType{ message = message }
        });

Consumer

using System;
using mytransit.core.Consumer;

namespace Events;

public class EventType
{
    public string message { get; set; }
}
public class ConsumerEvent : IConsumer<EventType>
{
    public async Task ConsumeAsync(IConsumeContext<EventType> context)
    {
        Console.WriteLine($"Message: {context.Message.message}");
        await Task.CompletedTask;
        
    }

}

About

RabbitMQ Library for .net

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages