Skip to content

Commit

Permalink
add registrations cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdihadeli committed Oct 28, 2022
1 parent a32a663 commit 053a7a6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mediatr.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@ func RegisterNotificationHandlers[TEvent any](handlers ...NotificationHandler[TE
return nil
}

func ClearRequestRegistrations() {
requestHandlersRegistrations = map[reflect.Type]interface{}{}
}

func ClearNotificationRegistrations() {
notificationHandlersRegistrations = map[reflect.Type][]interface{}{}
}

// Send the request to its corresponding request handler.
func Send[TRequest any, TResponse any](ctx context.Context, request TRequest) (TResponse, error) {
requestType := reflect.TypeOf(request)
Expand Down

0 comments on commit 053a7a6

Please sign in to comment.