Skip to content

Commit

Permalink
Add Disable() method to configurers.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmalloc committed Jul 16, 2024
1 parent e2615b6 commit bfdbd2f
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 0 deletions.
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{}
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 bfdbd2f

Please sign in to comment.