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)
-
0
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>());
-
0
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.
-
0
My advice is to do this in
appsetting.json
, you can pass default values toAbpKafkaOptions
andAbpKafkaEventBusOptions
on the code side, but it may create confusion for future readers.