forked from hibernate/hibernate-demos
-
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.
add Health Check uri to liveness and readiness probes
- Loading branch information
Showing
7 changed files
with
81 additions
and
21 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...nt-service/src/main/java/org/hibernate/demo/message/account/core/service/HealthCheck.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,34 @@ | ||
package org.hibernate.demo.message.account.core.service; | ||
|
||
import java.util.List; | ||
import javax.ejb.Stateless; | ||
import javax.inject.Inject; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
import org.hibernate.demo.message.account.core.entity.User; | ||
import org.hibernate.demo.message.account.core.repo.UserRepo; | ||
|
||
import org.slf4j.Logger; | ||
|
||
@Path("/health") | ||
@Stateless | ||
public class HealthCheck { | ||
|
||
@Inject | ||
private Logger log; | ||
|
||
@Inject | ||
private UserRepo repo; | ||
|
||
@GET | ||
@Produces(MediaType.APPLICATION_JSON) | ||
public List<User> healthCheck() { | ||
log.info( "healthCheck invoked by OCP" ); | ||
|
||
return repo.findAll(); | ||
} | ||
|
||
} |
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
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
33 changes: 33 additions & 0 deletions
33
...ssage-service/src/main/java/org/hibernate/demo/message/post/core/service/HealthCheck.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,33 @@ | ||
package org.hibernate.demo.message.post.core.service; | ||
|
||
import java.util.List; | ||
import javax.ejb.Stateless; | ||
import javax.inject.Inject; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
import org.hibernate.demo.message.post.core.entity.Message; | ||
|
||
import org.slf4j.Logger; | ||
|
||
@Path("/health") | ||
@Stateless | ||
public class HealthCheck { | ||
|
||
@Inject | ||
private Logger log; | ||
|
||
@Inject | ||
private MessageService service; | ||
|
||
@GET | ||
@Produces(MediaType.APPLICATION_JSON) | ||
public List<Message> healthCheck() { | ||
log.info( "healthCheck invoked by OCP" ); | ||
|
||
return service.findMessagesByUser( "andrea" ); | ||
} | ||
|
||
} |
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