[microprofile] @CircuitBreaker with configuration file does not override the requestVolumeThreshold.

13 views
Skip to first unread message

Charlee Chitsuk

unread,
Feb 18, 2019, 3:10:21 AM2/18/19
to Payara Forum

Dear Team,

I've tried to define the `@CircuitBreaker: requestVolumeThreshold and friends` via the `META-INF/microprofile-config.properties` with other value than the default as `20`, it still be `20`.

My environment is as the following:-

From Docker `payara/micro:latest`

-  Payara Version:  Payara Micro  5.184 #badassmicrofish (build 89)
- Edition: Micro
- JDK Version: 

openjdk version "1.8.0_181"
OpenJDK Runtime Environment (IcedTea 3.9.0) (Alpine 8.181.13-r0)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)

- Operating System: 

NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.8.1
PRETTY_NAME="Alpine Linux v3.8"




# META-INF/microprofile-config.properties
my.service.MyResource/alwaysFail/CircuitBreaker/failOn=java.lang.Throwable.class
my.service.MyResource/alwaysFail/CircuitBreaker/requestVolumeThreshold=4
my.service.MyResource/alwaysFail/CircuitBreaker/failureRatio=0.75d
my.service.MyResource/alwaysFail/CircuitBreaker/successThreshold=2
my.service.MyResource/alwaysFail/CircuitBreaker/delay=1000


package my.service;
@ApplicationPath("/myapi")
public class MyApplication extends Application {
}

package my.service;
@Path("ft")
@ApplicationScoped
public class MyResource {
    @GET
    @CircuitBreaker
    public Response alwaysFail() {
        throws new IllegalStateException("This always fails.");
    }
}



Even I've tried to execute the above `cURL`, for 5 times the response still be "java.lang.IllegalStateException: This always fails.". Furthermore when I execute at the 21st round, the `CircuitBreakerOpenException` has just been thrown. 

Please correct me, If I'm wrong. I understand that it use the default value from annotation as 20 and ignore the value configured via the `META-INF/microprofile-config.properties`. Could you please help to advise further?

Regards,

Charlee Ch.

Charlee Chitsuk

unread,
Feb 21, 2019, 4:41:28 AM2/21/19
to Payara Forum
Dear Team,

I also have a chance to look at the "FaultToleranceService" [1] and found that the method "registerCircuitBreaker"[2] use the "requestVolumeThreshold" from the annotation directly instead of using the read from the configuration file as

faultToleranceObjects.get(applicationName).getCircuitBreakerStates().get(invocationTarget)
                   .put(fullMethodSignature, new CircuitBreakerState(circuitBreaker.requestVolumeThreshold()));

I'm not sure if it may be a root cause or I may be misunderstood. Could you please help to advise further?

Regards,

Charlee Ch.


Reply all
Reply to author
Forward
0 new messages