Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Disable() method to configurers. #162

Merged
merged 2 commits into from
Jul 16, 2024
Merged

Add Disable() method to configurers. #162

merged 2 commits into from
Jul 16, 2024

Conversation

jmalloc
Copy link
Member

@jmalloc jmalloc commented Jul 8, 2024

What change does this introduce?

This PR introduces an Disable() method to each of the handler configured interfaces.

Why make this change?

It is often necessary to disable specific handlers by adding conditional logic to the application's Configure() method. For example, during tests we will often skip registering a projection handler if there is no SQL database available for testing.

This change allows the handler itself to decide if it should be disabled, rather than the application.

Is there anything you are unsure about?

I've added an as-yet-unused DisableOption in the interest for forward-compatibility. I'm hypothesising options such as a DisableIf(predicate func() bool), which could act as a circuit breaker that stops an engine from routing messages to a handler while some dependency is unavailable.

What issues does this relate to?

None

@jmalloc jmalloc requested review from koden-km and danilvpetrov July 8, 2024 02:50
Copy link
Member

@danilvpetrov danilvpetrov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me to introduce these methods.

@jmalloc jmalloc merged commit bdaeca7 into main Jul 16, 2024
4 checks passed
@jmalloc jmalloc deleted the handler-disable branch July 16, 2024 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants