Skip to content

A demo program to learn how to work with the Bolt key/value store.

Notifications You must be signed in to change notification settings

billhathaway/boltDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A demo program used to learn how to work with Bolt key/value store.
Build Status

This implements a very simple message queue. Operations are:

  • list queues
  • create queue
  • delete queue
  • send message
  • receive message(s)
  • get queue info

The data is represented in Bolt by two categories of buckets:

  • "queues" - holds an object for each queue
  • "$queuename-messages" - holds messages for each queue (one of these buckets per queue)

Paths served:

  /queues                GET lists all queues and their stats
 
  /queue/$name           POST creates the queue 
  /queue/$name           DELETE deletes the queue
  /queue/$name           GET retrieves statistics for the queue
  /queue/$name/messages  GET retrieves up to 10 messages
  /queue/$name/messages  POST sends a message with the content from the "message" parameter

Example session

# list queues (none should exist if using a fresh db)
curl "http://localhost:9999/queues"

# create two queues
curl -X POST "http://localhost:9999/queue/q1"
curl -X POST "http://localhost:9999/queue/q2"

# list queues, should now see two
curl "http://localhost:9999/queues"

# send some messages
curl -X POST --data message=hello1 "http://localhost:9999/queue/q1/messages"
curl -X POST --data message=hello2 "http://localhost:9999/queue/q1/messages"

# receive the messages
curl "http://localhost:9999/queue/q1/messages"

# send one more message
curl -X POST --data message=hello3 "http://localhost:9999/queue/q1/messages"

# list queues to show the stats are updated
curl "http://localhost:9999/queues"

# delete a queue 
curl -X DELETE "http://localhost:9999/queues/q1"

# list queues to show only q2 is remaining
curl "http://localhost:9999/queues"

About

A demo program to learn how to work with the Bolt key/value store.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published