November 2018
Intermediate to advanced
390 pages
10h 8m
English
The following code is an example of a circuit breaker using Ballerina. It will be listening on the port:9090 TCP, as well as on port:9091 TCP. The code is much more readable for programmers than the code for other languages:
//Circuit breaking example from https://ballerina.io/import ballerina/http;import ballerina/io;string previousRes;endpoint http:Listener listener {port:9090};// Endpoint with circuit breaker can short circuit responses under// some conditions. Circuit flips to OPEN state when errors or// responses take longer than timeout. OPEN circuits bypass// endpoint and return error.endpoint http:Client legacyServiceResilientEP {url: "http://localhost:9091",circuitBreaker: {// Failure calculation window ...Read now
Unlock full access