Core interfaces and primitives for the HelixBus MessageBus system, including request/notification abstractions and pipeline behavior definitions.
$ dotnet add package HelixBus.MessageBus.AbstractionsCore abstractions for the HelixBus MessageBus system.
Provides minimal interfaces for requests, handlers, notifications, and pipeline behaviors to enable a clean CQRS/mediator architecture.
IRequest<TResponse> / IRequestHandler<TRequest,TResponse> for query/command handlingINotification / INotificationHandler<TNotification> for eventsIPipelineBehavior<TRequest,TResponse>dotnet add package HelixBus.MessageBus.Abstractions
public record GetUserQuery(int Id) : IRequest<UserDto>;
public class GetUserQueryHandler : IRequestHandler<GetUserQuery, UserDto>
{
public Task<UserDto> Handle(GetUserQuery request, CancellationToken cancellationToken)
{
return Task.FromResult(new UserDto(request.Id, "John Doe"));
}
}
public class UserCreated : INotification
{
public int UserId { get; init; }
}
public class UserCreatedHandler : INotificationHandler<UserCreated>
{
public Task Handle(UserCreated notification, CancellationToken cancellationToken)
{
Console.WriteLine($"User created: {notification.UserId}");
return Task.CompletedTask;
}
}
MIT License. See LICENSE file.