Open Closed

Using distributed event bus within a console application #6964


User avatar
0
utku.birkan created
  • ABP Framework version: v8.0.5

  • UI Type: None

  • Database System: None

  • Tiered (for MVC) or Auth Server Separated (for Angular): N/A

  • Steps to reproduce the issue:

Hi, I'm writing a microservice to connect our ABP application with a legacy windows API. I have a console application that should import the said windows DLLs, and receive instructions on what to execute through the distributed event bus. I added AbpAbpEventBusRabbitMqModule into the dependency list of my application's module class. I can connect to a rabbitmq instance and push events, however event handlers do not receive anything.

Here's how I bootstrap the application. For the monitor loop, task queue and worker implementations I followed this Microsoft tutorial to keep things simple. I use ABP interfaces to register dependencies but didn't change all that much else.

using Siemens.PSSX.Bridge.Worker;
using ZLogger;

var builder = Host.CreateApplicationBuilder(args);

builder.Logging.ClearProviders().AddZLoggerConsole().AddZLoggerFile("Logs/logs.txt");
builder.Services.AddHostedService<Worker>();

await builder.Services.AddApplicationAsync<ApplicationModule>();

var host = builder.Build();

MonitorLoop monitorLoop = host.Services.GetRequiredService<MonitorLoop>()!;
monitorLoop.StartMonitorLoop();

await host.InitializeAsync();
await host.RunAsync();

1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can refer to this example: https://github.com/abpframework/abp-samples/tree/master/RabbitMqEventBus

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11