Open Closed

How to disable distributed event bus AutoEventSelectors #6012


User avatar
0
DominaTang created

I tried the settings below, none of them works.

Configure<AbpDistributedEntityEventOptions>(options =>
{
   
    options.AutoEventSelectors.Clear();
   options.AutoEventSelectors.RemovelAll(x=>true);
  options.AutoEventSelectors.Remove<JobLog>();
}

I have two MicroSerives, both has an Entity Called "JobLog", and I defined a shared Eto called "JobLogEto". Then both MicroSerivces binds to this JobLogEto from RabbitMQ's exchange binding info. Within one Micro Service, there is a code subscribe to this JobLogEto, and then I noticed there are duplicate records generated, if I manually unbind the second Micro Service to this eto, then no duplicate records insert. Even in second Micro Service, I didn't subscribe to this Eto. The event are triggered twice.

  • ABP Framework version: v7.2.1 + Micro Service

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

    Hi,

    Could you provide the full steps or share a project to reproduce the problem? I will check it. my email is shiwei.liang@volosoft.com

  • User Avatar
    0
    DominaTang created

    Hi,

    Could you provide the full steps or share a project to reproduce the problem? I will check it. my email is shiwei.liang@volosoft.com

    How about disable Abp's auto route binding for a MicroService?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    I don't recommend you do this, I think this may be a usage issue.

    If you are willing to provide detailed steps or projects I will try to help you.

  • User Avatar
    0
    DominaTang created

    Hi,

    I don't recommend you do this, I think this may be a usage issue.

    If you are willing to provide detailed steps or projects I will try to help you.

    Don't have time to prepare sample project code. I get rid of MongoDb side JobLog entity and related code only keep one Micro Service has JobLog entity. Then the duplicate log is gone.

    I have another question, when an event bus - event handler subscribe to an event, if the handler code has exception, the message is kept in the queue and keep sending to handler again and again? Is there a setting to set up the max try times or if handler failed, don't keep the message in the queue. (RabbitMQ distributed event bus) (

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    I have another question, when an event bus - event handler subscribe to an event, if the handler code has exception, the message is kept in the queue and keep sending to handler again and again? Is there a setting to set up the max try times or if handler failed, don't keep the message in the queue. (RabbitMQ distributed event bus)

    Yes, the event will be sending to the handler until completed, and there is no such max try times setting.

    If you want to ignore errors in an event handler, you must use a try-catch block in your handler and shouldn't re-throw the exception.

    https://docs.abp.io/en/abp/latest/Distributed-Event-Bus#transaction-and-exception-handling

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