Skip to content

Search EricksonLopez.* Ecosystem

Type a library name, NuGet package ID, .NET type, or architectural concept to search across the portal.

Configuration & Integrations — Events

using System.Text.Json;
using EricksonLopez.Events.Bus.Configuration;
using EricksonLopez.Events.Bus.Extensions;
using EricksonLopez.Events.Serialization.SystemTextJson;
using Microsoft.Extensions.DependencyInjection;
namespace Example.EventsConfig;
public static class EventsConfiguration
{
public static void Configure(IServiceCollection services, JsonSerializerOptions jsonOptions)
{
services.AddEventBus(options =>
{
options.ExecutionMode = EventExecutionMode.Sequential;
options.ErrorPolicy = ErrorHandlingPolicy.FailFast;
options.ScopePolicy = HandlerScopePolicy.Auto;
options.MaxReentrancyDepth = 10;
});
// Emitted at compile time by EricksonLopez.Events.Generators (v2.0.0+)
services.AddGeneratedEventHandlers();
jsonOptions.AddEventsConverters();
}
}
  • CloudEvents (EricksonLopez.Events.CloudEvents): Convert between envelopes and CNCF CloudEvents via .ToCloudEvent() and .ToEventEnvelope(), and configure STJ with jsonOptions.ConfigureForCloudEvents().
  • OpenTelemetry (EricksonLopez.Events.OpenTelemetry): Register tracerBuilder.AddEventsInstrumentation() and meterBuilder.AddEventsInstrumentation().