rxjs-probe

rxjs-probe provides an interface similar to Kubernetes probes using RxJS to detect service health.

MIT License

Downloads
1.5K
Stars
0

rxjs-probe provides an interface similar to Kubernetes probes using RxJS to detect service health.

🔗 Link

📥 Install

npm i rxjs @rxjs-probe/core

🔑 Usage

import { Probe, ProbePerformer } from '@rxjs-probe/core';
import axios from 'axios';

const probe = new Probe({
  performer: new ProbePerformer(async timeoutSeconds => {
    await axios({
      url: 'https://github.com/a179346/rxjs-probe',
      timeout: timeoutSeconds * 1000,
      validateStatus: status => status === 200,
    });
  }),
  initialDelaySeconds: 3,
  periodSeconds: 2,
  timeoutSeconds: 1,
  successThreshold: 1,
  failureThreshold: 3,
});

const probeObservable = probe.createObservable();

probeObservable is an RxJS Observable. You can subscribe to it to get the probe status.

Check the RxJS documentation - Observable for more information.

📖 Examples

You can find more examples on how to use rxjs-probe in rxjs-probe-examples GitHub repository.

🔎 Probe Performers

🤝 Contributing

Contributions, issues and feature requests are welcome!Feel free to check issues page.

🌟 Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2024 a179346. This project is MIT licensed.


This README was generated with ❤️ by readme-md-generator

Package Rankings
Top 31.6% on Npmjs.org