https://github.com/musobarlab/nsq-demo
Demo using NSQ, to Publish and Consume Message queue
https://github.com/musobarlab/nsq-demo
go golang message-queue nsq nsqclient queue
Last synced: 4 days ago
JSON representation
Demo using NSQ, to Publish and Consume Message queue
- Host: GitHub
- URL: https://github.com/musobarlab/nsq-demo
- Owner: musobarlab
- Created: 2018-02-04T08:58:49.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-04T09:37:10.000Z (about 7 years ago)
- Last Synced: 2025-03-30T19:42:23.815Z (23 days ago)
- Topics: go, golang, message-queue, nsq, nsqclient, queue
- Language: Go
- Size: 4.88 KB
- Stars: 5
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
### Simple Demo, How to use NSQ as a Message Queue
### Running
- Start NSQD, NSQLOOKUPD, and NSQADMIN```shell
docker-compose up
```- Start Backend API
```shell
cd publisher/
```
and```shell
go run main.go
```send message like this
```curl
curl -X POST \
http://localhost:3000/api/send \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-H 'postman-token: d8e4a3cc-fcad-2d07-29f7-ad2f47ba3e66' \
-d '{
"from": "Wuriyanto",
"content":{
"header": "Makan Makan",
"body": "Makan nasi"
}
}'
```open consumer folder
```shell
go run main.go
```you'll see the result like this
```shell
2018/02/04 15:49:01 INF 1 [wurys/ch] (127.0.0.1:4150) connecting to nsqd
2018/02/04 15:49:06 Got a message: {"from":"Wuriyanto","content":{"header":"Makan Makan","body":"Makan nasi"}}
```