Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
brake-client
Advanced tools
import BrakeClient from 'brake-client';
import rp from 'request-promise';
const SERVICE_NAME = 'a-service';
const brake = new BrakeClient(SERVICE_NAME);
//set health check.
brake.healthCheck(() => {
return rp({
method: 'get',
url: `/${SERVICE_NAME}/health`,
headers: {
'Content-Type': 'application/json'
}
});
});
brake.on('circuitOpen', () => {
logger.warn(`The service: ${SERVICE_NAME}'s circuit is opened.`);
});
brake.on('circuitClosed', () => {
logger.info(`The service: ${SERVICE_NAME}'s circuit is closed.`);
});
brake.fallback(err => {
throw new Error('Cannot invoke downstream service. please try again soon.', err);
});
export function getResource(id) {
const request = {
method: 'get',
url: `/${SERVICE_NAME}/v1/resources/:id`,
params: {id: id},
headers: {
'Content-Type': 'application/json'
}
};
return brake.circuit({send: rp}).send(request);
}
You can use brake client to invoke resource api. The example is
import resourceClient from './ResourceClient';
resourceClient.getResource(id).then(resource => {
console.log(resource);
})
The service name.
The options param is the same as brakes. We extend it, and support request handlers
Set a callback, when the circuit is open, the callback will be used for checking the service's health status, if the status is ok, the circuit will close.
See brakes for detail.
Return the circuit's status.
FAQs
An client with circuit.
We found that brake-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.