- Run NATS
docker run -p 4444:4444 nats -p 4444
- Create Web Server
- Create Worker
dotnet new console -n worker
- Add NATS to both projects
dotnet add package NATS.Client --version 0.8.1
- Add
ValuesController.cs
to web project
- Add
Program.cs
to worker project
- Run Projects
- Run CURL command
curl --header "Content-Type: application/json" \
--request POST \
--data 'my value' \
http://localhost:5000/api/values
- Worker logs
worker listening...
worker listening...
worker received {Subject=worker;Reply=null;Payload=<hello, world: >}
worker listening...
worker listening...
- Server logs
Hosting environment: Production
Content root path: /yourpathto/web
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
api/values my value
Is there any example to use publish and request? Thank you