abpframework / abpframework/abp

How to unsubscribe to an event when we remove an distributed event handler

Open
#3,034 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

abp-framework discussion feature priority:normal
Dominant language
C#
Stars
14.4k
Forks
3.7k
Avg merge
15h 32m
Merged PRs (30d)
106

Description

When we create a class implements the IDistributedEventHandler<T> (see), ABP automatically subscribes to the event. When you use the RabbitMQ provider, it subscribes to the event on the rubbitmq as durable.

That's fine and what we want. However, assume that we've decided to remove this handler. How to unsubscribe from the event? We need to discuss this.

Possible ideas (without thinking much):

  1. ABP gets a list of already subscribed events, checks with the current handlers, find the diff and removes old subscriptions. But this require some rabbitmq integration and I don't know if rabbitmq API allows it. Should check.
  2. Developer manually maintains a list of events to unsubscribe. ABP checks this list on app startup and unsubscribes from rabbitmq. This reduces startup time a little, but this is not important. Essential problem is: a) we need to manually manage it, b) when we decide to clean this list? When we sure that all unsubscribed? How to automate?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the referenced IDistributedEventHandler interface and inspect how the RabbitMQ provider creates durable subscriptions. Compare the proposed automatic and manual unsubscribe approaches, then establish the lifecycle, cleanup behavior, and verification needed before implementation can be considered complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, rabbitmq
Domain
backend, distributed-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.