-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature]: Kafka code for receiving users
- Loading branch information
Showing
6 changed files
with
79 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...iffler-userdata/src/main/java/com/rangiffler/controller/advices/UserControllerAdvice.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.rangiffler.controller.advices; | ||
|
||
|
||
import com.rangiffler.exception.ErrorResponse; | ||
import com.rangiffler.exception.UserNotFoundException; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.ControllerAdvice; | ||
import org.springframework.web.bind.annotation.ExceptionHandler; | ||
|
||
@ControllerAdvice | ||
public class UserControllerAdvice { | ||
|
||
@ExceptionHandler(UserNotFoundException.class) | ||
public ResponseEntity<ErrorResponse> userNotFoundHandler(UserNotFoundException exception) { | ||
return new ResponseEntity<>(new ErrorResponse(exception.getMessage()), HttpStatus.NOT_FOUND); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
rangiffler-userdata/src/main/java/com/rangiffler/exception/ErrorResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.rangiffler.exception; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@RequiredArgsConstructor | ||
public class ErrorResponse { | ||
|
||
private String error; | ||
} |
8 changes: 8 additions & 0 deletions
8
rangiffler-userdata/src/main/java/com/rangiffler/exception/UserNotFoundException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.rangiffler.exception; | ||
|
||
public class UserNotFoundException extends IllegalArgumentException { | ||
|
||
public UserNotFoundException(String message) { | ||
super(message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters