Activities of "carelschutte"

Hi,

We need to send events across applications and cannot use a shared ETO library. Some research indicate you can decorate the class with EventName attribute.

We implemented Rebus with Postgress but it does not look like Rebus can support routing with the EventName.

Is this even possible. Some code snippets out of our project:

Consumer: const string QueueName = "abc";

    PreConfigure<AbpRebusEventBusOptions>(options =>
    {
        options.InputQueueName = QueueName;
        options.Configurer = cfg =>
        {
            cfg.Transport(t => t.UsePostgreSql(
                    connectionString: rebusConnectionString,
                    tableName: "RebusMessages",
                    inputQueueName: QueueName))
               .Subscriptions(s => s.StoreInPostgres(rebusConnectionString, "RebusSubscriptions"));
        };
    });
}

Publisher:

internal class Program
{
    static async Task Main(string[] args)
    {
        Log.Logger = new LoggerConfiguration()

#if DEBUG .MinimumLevel.Debug() #else .MinimumLevel.Information() #endif .MinimumLevel.Override("Microsoft", LogEventLevel.Information) .Enrich.FromLogContext() .WriteTo.Async(c => c.File("Logs/logs.txt", rollingInterval: RollingInterval.Day)) #if DEBUG .WriteTo.Async(c => c.Console()) #endif .CreateLogger();

        var configuration = new ConfigurationBuilder()
            .AddJsonFile("appsettings.json", optional: true)
            .AddUserSecrets<Program>()
            .AddEnvironmentVariables()
            .Build();

        using var app = AbpApplicationFactory.Create<CLIModule>(options =>
        {
            options.UseAutofac();
            options.Services.ReplaceConfiguration(configuration);
            options.Services.AddLogging(loggingBuilder =>
            {
                loggingBuilder.ClearProviders();
                loggingBuilder.AddSerilog();
            });
        });

        await app.InitializeAsync();

        var eventBus = app.ServiceProvider.GetRequiredService<IDistributedEventBus>();
        var uowManager = app.ServiceProvider.GetRequiredService<IUnitOfWorkManager>();

        var evt = new TenantChangedEventEto
        {
            Id = Guid.NewGuid(),
            Name = "SampleTenant",
            NormalizedName = "SAMPLETENANT",
            EditionId = null,
            //ChangeType = TenantChangeType.Created
        };

        using (var uow = uowManager.Begin())
        {
            await eventBus.PublishAsync(evt);
            await uow.CompleteAsync();
        }

        Console.WriteLine("Event published!");
        Console.ReadLine();
        await app.ShutdownAsync();

    }
}

}

ETO (each project in its own namespace):

[EventName("TenantChanged")] public class TenantChangedEventEto { public Guid Id { get; set; } public string Name { get; set; } = null!; public string NormalizedName { get; set; } = null!; public Guid? EditionId { get; set; } }

But this CLI continues to report:

[17:30:51 DBG] Sending Accounting.Etos.TenantChangedEventEto -> "<no destinations>"

I even added the "TenantChanged" entry to the RebusSubscriptions table.

As a side note. I've tested this sharing a single class then the publisher works and the events fire.

ABP version: 9.2.2

Let me know if you need more info.

Carel

Showing 1 to 1 of 1 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on October 07, 2025, 05:59