Open Closed

IDistributedEventHandler does not subscribe the event which is published by Identity while using module template #2806


User avatar
0
uyarbtrlp created
  • ABP Framework version: v5.1.4
  • UI type: MVC
  • DB provider: EF Core
  • Module Template: yes
  • Steps to reproduce the issue:"
  1. I've created the module template by using abp suite.
  2. I've used the Separated Deployment & Databases Scenario. Therefore, I've runned update-db.ps1 script in both HttpApi.Host and IdentityServer projects.
  3. I've runned the solution.
  4. I've created the TestUserHandler class under TestApplication.Domain and subscribe the UserEto.
  5. I've given a reference Volo.Abp.Users.Domain for using UserEto.
   public class TestUserHandler : IDistributedEventHandler<EntityCreatedEto<UserEto>>, ITransientDependency
    {

        private readonly ICurrentTenant _currentTenant;


        private readonly ILogger<TestUserHandler> _logger;


        public TestUserHandler( ICurrentTenant currentTenant, ILogger<TestUserHandler> logger)
        {
            _currentTenant = currentTenant;
            _logger = logger;
        }
        public virtual async Task HandleEventAsync(EntityCreatedEto<UserEto> eventData)
        {

            
        }
    }
  1. I couldn't subscribe the event while adding a new user.
  2. When I use the same structure on Single (Unified) Application Scenario, I can subscribe the event and see the data of new user. It is same for EntityUpdatedEto<UserEto>
  3. Do I need to add external packages or codes for getting the event data or is it a kind of bug? How can I resolve this?
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

5 Answer(s)
  • User Avatar
    0
    gterdem created
    Senior .NET Developer

    Did you follow this configuration document?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    uyarbtrlp created

    Yes, of course. When I configure and map the object which is created by me like document you sent, I can subscribe the event. Like I mentioned, I couldn't subscribe events related with Identity such as creating a new user, creating a new role. Also, I can subscribe these events on Single (Unified) Application Scenario, but not on Separated Deployment & Databases Scenario. I realized above code block, somehow, didn't represent the handler which I created.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    gterdem created
    Senior .NET Developer

    Can you also check the rabbitmq-management page when an event is published to guarantee the event is published?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    uyarbtrlp created

    I am using the LocalDistributedEventBus which is default.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    gterdem created
    Senior .NET Developer

    I am using the LocalDistributedEventBus which is default.

    The user is created at IdentityServer and you are trying to handle it in an Http.Api.Host application. LocalDistributedEventBus works in-process. You need to use a distributed event bus provider like RabbitMq or Kafka.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
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.8.0-preview. Updated on September 24, 2026, 12:09
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.