Trying to test the Microprofile Fault Tolerance in WebSphere Liberty (WebSphere Application Server 18.0.0.3/wlp-1.0.22.cl180320180905-2337) on Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_161-b12 (en_US) but i cannot get the bulkhead logic to kick in.
Created a REST resource:
import org.eclipse.microprofile.faulttolerance.Bulkhead;
@Path("bulk")
public class BulkheadResource {
@GET
@Bulkhead(1)
public String getBulk() {
return getMessage();
}
private String getMessage() {
String vMessage = "Start: " + System.currentTimeMillis();
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
return vMessage;
}
}
And calls it from JMeter with 3 threads. My expectation was that the first call would work fine but 2nd and 3rd would fail since call one was hogging the only thread and the bulkhead would work.
Instead after 5s all three threads returned a 200 response:
timeStamp elapsed label responseCode threadName grpThreads
1539095137936 5057 GET Bulk 200 Micro Profile 1-1 3
1539095138272 5041 GET Bulk 200 Micro Profile 1-2 2
1539095138608 5029 GET Bulk 200 Micro Profile 1-3 1
Server.xml:
<featureManager>
<feature>microProfile-2.0</feature>
<feature>localConnector-1.0</feature>
</featureManager>
Any ideas?
The circuitBreaker is linked to the instance. In your example, your bean is dependent scoped and it has its own circuit breaker per request. If you change to ApplicationScoped, you should see what you expected happening.