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
// ==UserScript== | |
// @name Tremolo converter | |
// @namespace https://gist.github.com/skaveesh/ab93df4414732e69ad1cb0204dcb20b1 | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author Samintha Kaveesh | |
// @match https://www.harptabs.com/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=harptabs.com | |
// @grant none | |
// @run-at document-end |
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
resilience4j.circuitbreaker: | |
configs: | |
default: | |
registerHealthIndicator: true | |
slidingWindowSize: 15 | |
#Configures the size of the sliding window which is used to record the outcome of calls when the CircuitBreaker is closed. | |
#15 seconds since slidingWindowType is TIME_BASED | |
minimumNumberOfCalls: 2 |
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
//code is omitted for brevity | |
public final class SupplierUtil { | |
@FunctionalInterface | |
public interface SupplierWithException<T, E extends Exception> { | |
T get() throws Throwable; | |
} | |
public static <T, E extends Exception> Supplier<T> rethrowSupplier(SupplierWithException<T, E> supplier) { |
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
//code is omitted for brevity | |
@Aspect | |
@Component | |
public class CircuitBreakerAOPConfig { | |
private static final Logger LOGGER = LoggerFactory.getLogger(CircuitBreakerAOPConfig.class); | |
private final CircuitBreaker circuitBreaker; |
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
//code is omitted for brevity | |
@Service | |
public class DownstreamService { | |
private final CircuitBreaker circuitBreaker; | |
/** | |
* Instantiates a new Res 4 j service. | |
*/ | |
public DownstreamService(CircuitBreakerRegistry circuitBreakerRegistry) { |
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
//code is omitted for brevity | |
@Retention(RetentionPolicy.RUNTIME) | |
@Target({ElementType.METHOD}) | |
public @interface EnableCircuitBreakerScan { } |
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
//code is omitted for brevity | |
@Aspect | |
@Component | |
public class CircuitBreakerAOPConfig { | |
@Around("@annotation(com.skaveesh.dcb.annotation.EnableCircuitBreakerScan)") | |
public Object around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable { | |
Object[] args = proceedingJoinPoint.getArgs(); |
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
//code is omitted for brevity | |
@RestControllerAdvice | |
@Component | |
public class ApplicationResponseEntityExceptionHandler extends ResponseEntityExceptionHandler { | |
private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationResponseEntityExceptionHandler.class); | |
@ExceptionHandler(CircuitBreakerDownstreamCallException.class) | |
public ResponseEntity<Map<String, Object>> handleException(final Exception exception, final HttpServletRequest request) { |
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
//code is omitted for brevity | |
@RestController("/") | |
public class Controller { | |
//code is omitted for brevity | |
@GetMapping(value = "calltest", produces = MediaType.APPLICATION_JSON_VALUE) | |
public ResponseEntity<Object> callTest(){ | |
return new ResponseEntity<>(downstreamService.callTest(), HttpStatus.OK); |
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
//code is omitted for brevity | |
@Service | |
public class DownstreamService { | |
//code is omitted for brevity | |
/** | |
* Response from this API call will not have a delay | |
* |
NewerOlder