Reminder.Platform.Contracts
1.0.1
dotnet add package Reminder.Platform.Contracts --version 1.0.1
NuGet\Install-Package Reminder.Platform.Contracts -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Reminder.Platform.Contracts" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Reminder.Platform.Contracts" Version="1.0.1" />
<PackageReference Include="Reminder.Platform.Contracts" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Reminder.Platform.Contracts --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Reminder.Platform.Contracts, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Reminder.Platform.Contracts@1.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Reminder.Platform.Contracts&version=1.0.1
#tool nuget:?package=Reminder.Platform.Contracts&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Reminder.Platform.Contracts
Biblioteca compartilhada de contratos de eventos para a Reminder Platform.
Objetivo
Este projeto centraliza os contratos usados entre microserviços em uma arquitetura orientada a eventos com RabbitMQ.
Serviços que consomem este pacote:
Reminder Orchestrator Service(publisher)Notification Email Service(consumer)Notification SMS Service(consumer)Notification WhatsApp Service(consumer)
Stack
.NET 10(net10.0)System.Text.JsonFluentValidation
Estrutura
src/Abstractions/IEvent.cs
src/Events/v1/ReminderTriggeredEvent.cs
src/Validation/v1/ReminderTriggeredEventValidator.cs
Versionamento de eventos
O versionamento é feito por namespace e pasta:
- Versão atual:
Reminder.Platform.Contracts.Events.v1 - Futuras versões:
Reminder.Platform.Contracts.Events.v2
Recomendação para evolução:
- Não quebrar contratos existentes em
v1. - Para mudanças breaking, criar novo evento em
v2. - Manter consumidores antigos apontando para
v1até migração completa.
Exemplo de serialização com System.Text.Json
using System.Text.Json;
using Reminder.Platform.Contracts.Events.v1;
var @event = new ReminderTriggeredEvent
{
ReminderId = Guid.NewGuid(),
UserId = Guid.NewGuid(),
Message = "Seu lembrete foi disparado",
Timestamp = DateTime.UtcNow
};
var json = JsonSerializer.Serialize(@event);
var deserialized = JsonSerializer.Deserialize<ReminderTriggeredEvent>(json);
Exemplo MassTransit - Publish (Orchestrator)
using MassTransit;
using Reminder.Platform.Contracts.Events.v1;
public class ReminderPublisher
{
private readonly IPublishEndpoint _publishEndpoint;
public ReminderPublisher(IPublishEndpoint publishEndpoint)
{
_publishEndpoint = publishEndpoint;
}
public Task PublishAsync(Guid reminderId, Guid userId, string message)
{
return _publishEndpoint.Publish(new ReminderTriggeredEvent
{
ReminderId = reminderId,
UserId = userId,
Message = message,
Timestamp = DateTime.UtcNow
});
}
}
Exemplo MassTransit - Consume (Notificação)
using FluentValidation;
using MassTransit;
using Reminder.Platform.Contracts.Events.v1;
using Reminder.Platform.Contracts.Validation.v1;
public class ReminderTriggeredConsumer : IConsumer<ReminderTriggeredEvent>
{
private readonly IValidator<ReminderTriggeredEvent> _validator = new ReminderTriggeredEventValidator();
public async Task Consume(ConsumeContext<ReminderTriggeredEvent> context)
{
var validation = await _validator.ValidateAsync(context.Message, context.CancellationToken);
if (!validation.IsValid)
{
throw new ValidationException(validation.Errors);
}
// processar envio de notificação (email, sms, whatsapp)
}
}
Uso em outros serviços
- Referencie este projeto/pacote no microserviço.
- Use os tipos de
Events.v1para publicar/consumir. - Aplique os validadores de
Validation.v1no boundary do consumer.
Publicação no NuGet
Publicar manualmente
dotnet restore src/Reminder.Platform.Contracts.csproj
dotnet build src/Reminder.Platform.Contracts.csproj -c Release
dotnet pack src/Reminder.Platform.Contracts.csproj -c Release -o ./artifacts
dotnet nuget push .\artifacts\Reminder.Platform.Contracts.*.nupkg --api-key <SUA_API_KEY> --source https://api.nuget.org/v3/index.json
Publicação automática com GitHub Actions
O workflow está em .github/workflows/nuget-publish.yml.
- Dispara manualmente (
workflow_dispatch) ou via tagv*.*.*. - Exemplo de tag:
v1.0.1.
Configure o secret do repositório:
NUGET_API_KEY: API key do NuGet.org com permissão de push.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- FluentValidation (>= 11.11.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.1 | 126 | 4/8/2026 |