Skip to content

Commit

Permalink
Merge pull request #162 from dogmatiq/handler-disable
Browse files Browse the repository at this point in the history
Add Disable() method to configurers.
  • Loading branch information
jmalloc authored Jul 16, 2024
2 parents d139987 + bfdbd2f commit bdaeca7
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 1 deletion.
11 changes: 11 additions & 0 deletions aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,17 @@ type AggregateConfigurer interface {
// Aggregate handlers support the HandlesCommand() and RecordsEvent() route
// types.
Routes(...AggregateRoute)

// Disable prevents the handler from receiving any messages.
//
// The engine MUST NOT call any methods other than Configure() on a disabled
// handler.
//
// Disabling a handler is useful when the handler's configuration prevents
// it from operating, such as when it's missing a required dependency,
// without requiring the user to conditionally register the handler with the
// application.
Disable(...DisableOption)
}

// AggregateCommandScope performs engine operations within the context of a call
Expand Down
4 changes: 4 additions & 0 deletions disable.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package dogma

// DisableOption is an option that affects the behavior of a disabled handler.
type DisableOption struct{}
2 changes: 1 addition & 1 deletion docs/vale/config/vocabularies/Technical/accept.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[Dd]eduplication
[Dd]estroy
[Dd]isable
[Dd]isabled
Expand All @@ -19,5 +20,4 @@
[Oo]nly
[Vv]alidate
[Ww]hitespace
deduplication
ADR|adr
11 changes: 11 additions & 0 deletions integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ type IntegrationConfigurer interface {
// Integration handlers support the HandlesCommand() and RecordsEvent()
// route types.
Routes(...IntegrationRoute)

// Disable prevents the handler from receiving any messages.
//
// The engine MUST NOT call any methods other than Configure() on a disabled
// handler.
//
// Disabling a handler is useful when the handler's configuration prevents
// it from operating, such as when it's missing a required dependency,
// without requiring the user to conditionally register the handler with the
// application.
Disable(...DisableOption)
}

// IntegrationCommandScope performs engine operations within the context of a
Expand Down
11 changes: 11 additions & 0 deletions process.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,17 @@ type ProcessConfigurer interface {
// Process handlers support the HandlesEvent(), ExecutesCommand() and
// SchedulesTimeout() route types.
Routes(...ProcessRoute)

// Disable prevents the handler from receiving any messages.
//
// The engine MUST NOT call any methods other than Configure() on a disabled
// handler.
//
// Disabling a handler is useful when the handler's configuration prevents
// it from operating, such as when it's missing a required dependency,
// without requiring the user to conditionally register the handler with the
// application.
Disable(...DisableOption)
}

// ProcessEventScope performs engine operations within the context of a call
Expand Down
11 changes: 11 additions & 0 deletions projection.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@ type ProjectionConfigurer interface {
//
// The default policy is UnicastProjectionDeliveryPolicy.
DeliveryPolicy(ProjectionDeliveryPolicy)

// Disable prevents the handler from receiving any messages.
//
// The engine MUST NOT call any methods other than Configure() on a disabled
// handler.
//
// Disabling a handler is useful when the handler's configuration prevents
// it from operating, such as when it's missing a required dependency,
// without requiring the user to conditionally register the handler with the
// application.
Disable(...DisableOption)
}

// ProjectionEventScope performs engine operations within the context of a call
Expand Down

0 comments on commit bdaeca7

Please sign in to comment.