Starts in:
1 DAY
4 HRS
3 MIN
46 SEC
Starts in:
1 D
4 H
3 M
46 S
Open Closed

check enable or disable Kafka for DistributedEvent #3139


User avatar
0
ElifKaya created

Hi,

We have a 2 different module and we used Kafka in only one. The module which has Kafka integration is attached as a reference in the other console application. But, we also used IDistributedEventHandler in console app. So, when we trigger IDistributedEventHandler on console application, it needs running Kafka server because of dependencies.

So, We need to Kafka enabled false/true something like bellow in console application

Can you give an advice? Thanks,

ABP Framework version: v5.1.1

UI type: MVC

DB provider: EF Core

Tiered (MVC): yes

Exception message and stack trace:

Steps to reproduce the issue:"


3 Answer(s)
  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    I think you can do it by replacing the service.

    https://docs.abp.io/en/abp/latest/Dependency-Injection#replace-a-service

    Can you try the code below?

    context.Services.Replace(ServiceDescriptor.Singleton<IDistributedEventBus, LocalDistributedEventBus>());

  • User Avatar
    0
    ElifKaya created

    I think you can do it by replacing the service.

    https://docs.abp.io/en/abp/latest/Dependency-Injection#replace-a-service

    Can you try the code below?

    context.Services.Replace(ServiceDescriptor.Singleton<IDistributedEventBus, LocalDistributedEventBus>());

    Thanks a lot, it works. But, I still need to give a kafka topic name to the appsettings.json file. What could be the reason for this? If there is no solution for this, I can continue to set kafka topic name in appsettings file in console app.

  • User Avatar
    0
    berkansasmaz created
    Support Team .NET Developer

    My advice is to do this in appsetting.json, you can pass default values to AbpKafkaOptions and AbpKafkaEventBusOptions on the code side, but it may create confusion for future readers.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 20, 2024, 13:06