Skip to content

Latest commit

 

History

History
54 lines (39 loc) · 1.74 KB

GETTING_STARTED.md

File metadata and controls

54 lines (39 loc) · 1.74 KB

Newque-Nodejs Getting Started

The Newque driver for node.js. Newque is a light-weight and powerful message broker.

Pre-requisites

Docker needs to be installed HTTPie needs to be installed

Start the docker container

This will startup a docker container using the default configuration. On port 8000 there is an HTTP listener with a SQL backend.

docker pull newque/newque
docker run -p 8000:8000 -p 8001:8001 -p 8005:8005 -d -t newque/newque

Where to find more info?

Go to the newque docs: https://newque.github.io/ How to use HTTPie: https://httpie.org/doc

Write A Message

Using HTTPie let's write a series of messages to Newque: http POST localhost:8000/v1/example atomic:=true messages:='["abc","def","ghi"]' --json

Using curl: curl -H "Content-Type: application/json" -X POST "localhost:8000/v1/example" -d '{"atomic":"true","messages":["abc","def","ghi"]}'

Count the Stored Messages

Using HTTPie let's count how many messages are stored: http GET localhost:8000/v1/example/count

Using curl

curl -i "localhost:8000/v1/example/count"

Read the Stored Messages

This will read one message (the first stored) using HTTPie: http GET localhost:8000/v1/example 'newque-mode:one'

Using curl: curl -i "localhost:8000/v1/example" -H "newque-mode:one"

To extract multiple messages at once: http GET localhost:8000/v1/example 'newque-mode:many 2'

To extract after a specific ID: http GET localhost:8000/v1/example 'newque-mode:after_id e28e1e86-f925-4922-9c62-30d57ebb7a62'

Admin API Functions

To check the configuration of the server. This will return the channels: curl -i localhost:8001/channels

This will return the listeners setup on the server: curl -i localhost:8001/listeners