EasyNetQ Handler Registration (Consumer/HandlerRegistrationExtensions.cs)

EasyNetQ · Source/EasyNetQ/Consumer/HandlerRegistrationExtensions.cs · csharp · MIT
integration, infra, chat, lang:csharp

Provides extension methods for registering asynchronous message handlers in EasyNetQ, simplifying consumer logic for RabbitMQ.

// Source: https://github.com/EasyNetQ/EasyNetQ | License: MIT
// Provided via justclaw.it.com; keep this notice with the code.
using EasyNetQ.Internals;

namespace EasyNetQ.Consumer;

/// <summary>
///     Version extensions for IHandlerRegistration
/// </summary>
public static class HandlerRegistrationExtensions
{
    /// <summary>
    /// Add an asynchronous handler
    /// </summary>
    /// <typeparam name="T">The message type</typeparam>
    /// <param name="handlerRegistration">The handler registration</param>
    /// <param name="handler">The handler</param>
    /// <returns></returns>
    public static IHandlerRegistration Add<T>(
        this IHandlerRegistration handlerRegistration, Action<IMessage<T>, MessageReceivedInfo> handler
    )
    {
        var asyncHandler = TaskHelpe

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key