Skip to content

P7CoreOrg/dotnetcore-nats-play

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

dotnetcore-nats-play

NATS Playground

In the solution folder run the following command

docker-compose -f .\docker-compose.yml up --scale nats-replier=2 --scale nats-subscribe=2  

To verify that it is up navigate http://localhost:8222/

nats-replier is listening to the "dog" subject and is in a queue group, so the replier will be randomly selected to process the message.

...src\Requestor>dotnet run -verbose -subject=dog -count 50

NATS Streaming Server

I have 2 intances of stan-sub running, where each has a different clientID. They shared duties of any message published to their queue.

...src\stan-pub>dotnet run -server nats://localhost:4223 -subject dog -count 10 -verbose

The examples, which I copied from nats.net assume the standard ports (4222) which you can override.

NATS on Kubernetes

I used bitnami's kubeapps to install their version of NATS, and then I port-forward so that I can test against it.

kubectl port-forward pods/utter-lumber-nats-0 4222:4222 8222:8222