optimierungen Trace-Bullet
This commit is contained in:
@@ -5,9 +5,7 @@ import org.springframework.web.bind.annotation.RequestParam
|
||||
import org.springframework.web.bind.annotation.RestController
|
||||
|
||||
@RestController
|
||||
class PingController(
|
||||
private val pingServiceCircuitBreaker: PingServiceCircuitBreaker
|
||||
) {
|
||||
class PingController {
|
||||
|
||||
/**
|
||||
* Standard ping endpoint - maintains backward compatibility
|
||||
@@ -19,12 +17,10 @@ class PingController(
|
||||
|
||||
/**
|
||||
* Enhanced ping endpoint with circuit breaker protection
|
||||
*
|
||||
* @param simulate - whether to simulate failures for testing circuit breaker
|
||||
*/
|
||||
@GetMapping("/ping/enhanced")
|
||||
fun enhancedPing(@RequestParam(defaultValue = "false") simulate: Boolean): Map<String, Any> {
|
||||
return pingServiceCircuitBreaker.ping(simulate)
|
||||
return mapOf("status" to "pong", "message" to "Circuit breaker not available")
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -32,7 +28,7 @@ class PingController(
|
||||
*/
|
||||
@GetMapping("/ping/health")
|
||||
fun health(): Map<String, Any> {
|
||||
return pingServiceCircuitBreaker.healthCheck()
|
||||
return mapOf("status" to "UP", "message" to "Circuit breaker not available")
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,6 +36,6 @@ class PingController(
|
||||
*/
|
||||
@GetMapping("/ping/test-failure")
|
||||
fun testFailure(): Map<String, Any> {
|
||||
return pingServiceCircuitBreaker.ping(simulateFailure = true)
|
||||
return mapOf("status" to "error", "message" to "Circuit breaker not available")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package at.mocode.temp.pingservice
|
||||
|
||||
import io.github.resilience4j.circuitbreaker.annotation.CircuitBreaker
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication
|
||||
import org.springframework.boot.runApplication
|
||||
import org.springframework.context.annotation.EnableAspectJAutoProxy
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableAspectJAutoProxy
|
||||
class PingServiceApplication
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
|
||||
Reference in New Issue
Block a user