Skip to content

Latest commit

 

History

History

12-Connecting-NATS-In-NodeJS

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

NATS Streaming Server - An Event Bus Implementation


Three Important Items


Application


Big Notes on NATS Streaming


Application


Application


Building a NATS Test Project


Application


$ cd app
$ mkdir nats-test
$ cd nats-test
$ npm init -y
$ npm install --save node-nats-streaming ts-node-dev typescript @types/node

$ tsc --init

Port-Forwarding with Kubectl

$ kubectl get pods
NAME                                        READY   STATUS    RESTARTS   AGE
auth-deployment-59d887f775-h9nxq            1/1     Running   0          109m
auth-mongo-deployment-d79ff8f7c-lj92m       1/1     Running   0          109m
client-deployment-65576ffc88-vxvv4          1/1     Running   0          109m
nats-deployment-6bf654c867-cvc2q            1/1     Running   0          109m
tickets-deployment-5c57b69d6c-kbb6c         1/1     Running   0          109m
tickets-mongo-deployment-869f7b4c75-9q48f   1/1     Running   0          109m

$ kubectl port-forward nats-deployment-6bf654c867-cvc2q 4222:4222
$ kubectl port-forward nats-deployment-6bf654c867-cvc2q 8222:8222

$ cd nats-test
$ npm run publish

Publishing Events


Application


Listening For Data


$ npm run listen

console with publisher: rs + [Enter]

Accessing Event Data


Application


Queue Groups


Application


Client Health Checks

browser

http:https://localhost:8222/streaming
http:https://localhost:8222/streaming/channelsz?subs=1

[Optional] More Possible Concurrency Solutions


Solving Concurrency Issues


Application


Application


Concurrency Control with the Tickets App


Application


Application


Event Redelivery


Durable Subscriptions


Application