-
Notifications
You must be signed in to change notification settings - Fork 35
/
mediator_configurations.go
23 lines (19 loc) · 1.14 KB
/
mediator_configurations.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package configurations
import (
"context"
"github.com/mehdihadeli/go-mediatr"
"github.com/meysamhadeli/shop-golang-microservices/internal/pkg/logger"
"github.com/meysamhadeli/shop-golang-microservices/internal/pkg/rabbitmq"
"github.com/meysamhadeli/shop-golang-microservices/internal/services/identity_service/identity/data/contracts"
registeringuserv1commands "github.com/meysamhadeli/shop-golang-microservices/internal/services/identity_service/identity/features/registering_user/v1/commands"
registeringuserv1dtos "github.com/meysamhadeli/shop-golang-microservices/internal/services/identity_service/identity/features/registering_user/v1/dtos"
)
func ConfigUsersMediator(log logger.ILogger, rabbitmqPublisher rabbitmq.IPublisher,
userRepository contracts.UserRepository, ctx context.Context) error {
//https://stackoverflow.com/questions/72034479/how-to-implement-generic-interfaces
err := mediatr.RegisterRequestHandler[*registeringuserv1commands.RegisterUser, *registeringuserv1dtos.RegisterUserResponseDto](registeringuserv1commands.NewRegisterUserHandler(log, rabbitmqPublisher, userRepository, ctx))
if err != nil {
return err
}
return nil
}