top of page

Kriten NATS - Feature Preview

  • Apr 2
  • 1 min read

NATS is an open-source messaging system that provides publish/subscribe and request/reply distribution models.

The Kriten-NATS feature preview is designed to demonstrate how Kriten and NATS can be used build an event-driven automation system.


requester.py

Puts messages on the NATs queue kriten.job.requests The message contains kriten task name and any optional arguments.


responder.py

Subscribes to kriten.job.requests and launches the kriten jobs. Returns job id to the requester. Posts job result to kriten.job.results


results.py

Subscribes to kriten.job.results and prints job stdout.


Example usage:

uv run requester.py -t sendslack -d msg="Hello from NATS"
Kriten job:  {"id": "sendslack-pr5mm", "msg": "job created successfully"}


Install the responder on k8S

Add/update the helm repo

helm repo add kriten https://kriten-io.github.io/kriten-charts
helm repo update

Install kriten-nats

helm install responder kriten/kriten-nats -n kriten \
--set nats_host=<hostname where NATS server is running> \
--set nats_port=<NATS port, usually 4222> \
--set kriten_url=<URL for Kriten> \
--set kriten_api_token=<Kriten API token>

Create a Kriten API token

You can do this through the swagger interface.

Browse to <kriten_url>/swagger/index.html


Login (default account root:root)


Copy the login token excluding the quotes. Press Authorize button, right-hand side of first page.

Enter the word Bearer and the token.

You can now create an API token. Scroll to the POST /api_tokens section. Click Try it out and enter a description.


The result should contain an API token, starting with kri_.


 
 
bottom of page