Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new-file-notification via NATS #44

Merged
merged 8 commits into from
Apr 29, 2024
Merged

Add new-file-notification via NATS #44

merged 8 commits into from
Apr 29, 2024

Conversation

digizeph
Copy link
Member

@digizeph digizeph commented Apr 26, 2024

This PR adds new-file notification by publishing newly indexed BGP MRT file meta information in JSON format to user-specified NATS server.

The NATS URL and credentials is configured via environment variables:

  • BGPKIT_BROKER_NATS_URL like nats://nats.bgpkit.com:4222 (default)
  • BGPKIT_BROKER_NATS_ROOT_SUBJECT such as public.broker. (default)

The notification is published to public.broker.{PROJECT}.{COLLECTOR}.{DATA_TYPE} where

  • PROJECT is riperis or route-views
  • COLLECTOR is the route collector IDs like rrc00 or route-views2
  • DATA_TYPE is rib or updates

Example of what a subscriber can be notified for:

  • public.broker.>: any new MRT files
  • public.broker.route-views.>: new RouteViews updates files
  • public.broker.rrc00.rib: new RIPE RIS rrc00 RIB dump files
  • public.broker.*.rib: any new RIB dump files

This PR also adds a new subcommand bgpkit-broker live that listens to the specified NATS server for new file notification.

Streaming live from a broker NATS server

Usage: bgpkit-broker live [OPTIONS]

Options:
      --no-log             disable logging
  -u, --url <URL>          URL to NATS server, e.g. nats://localhost:4222. If not specified, will try to read from BGPKIT_BROKER_NATS_URL env variable
      --env <ENV>          
  -s, --subject <SUBJECT>  Subject to subscribe to, default to public.broker.>
  -p, --pretty             Pretty print JSON output
  -h, --help               Print help
  -V, --version            Print version

This resolves issue #41.

@digizeph digizeph merged commit d0dcb2e into main Apr 29, 2024
1 check passed
@digizeph digizeph deleted the feature/nats branch April 29, 2024 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant